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 |
|---|---|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from google.appengine.ext import webapp
from notifiy import constants
class Home(webapp.RequestHandler):
def get(self):
self.redirect(constants.ROBOT_HOME_PAGE)
| ajibawa-2023/Python-Code-Large/train/row_1097 | 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_1097:ImportFrom_L4_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.3636, 0.0909, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1097:ImportFrom_L6_C0", "label": "from notifiy import constants", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0909, 0, 0.66, 0.5, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["constants"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import constants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1097:ClassDef_L9_C0", "label": "Home", "type": "class", "loc": [9, 11], "level": 0, "parent": null, "vector": [3, 0, 0.9091, 0.2727, 0, 0.66, 1.0, 89, 0, 1, 0, 0, 256, 0, 1], "semantic": {"name": "Home", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Home(webapp.RequestHandler):\n def get(self):\n self.redirect(constants.ROBOT_HOME_PAGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1097:FunctionDef_L10_C4", "label": "get", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1097:ClassDef_L9_C0", "vector": [2, 1, 0.9545, 0.1818, 1, 0.61, 0.0, 607, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n self.redirect(constants.ROBOT_HOME_PAGE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1097:Expr_L11_C8", "label": "redirect()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1097:FunctionDef_L10_C4", "vector": [8, 2, 1.0, 0.0909, 2, 0.95, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " self.redirect(constants.ROBOT_HOME_PAGE)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1097:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1097:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1097:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1097:Expr_L11_C8"}] |
# -*- coding: UTF-8 -*-
import base64
import urllib
def get_url(participant, wave_id):
domain = participant.split('@')[1]
if wave_id:
wave_id = urllib.quote(urllib.quote(wave_id))
if wave_id and domain == 'googlewave.com':
return 'https://wave.google.com/wave/#restored:wave:%s' % wave_id
elif wave_id:
return 'https://wave.google.com/a/%s/#restored:wave:%s' % (wave_id, domain)
else:
return ''
def modified_b64encode(s):
if type(s) == unicode:
s = s.decode('UTF-8')
return base64.urlsafe_b64encode(s).replace('=', '')
def modified_b64decode(s):
while len(s) % 4 != 0:
s = s + '='
return base64.urlsafe_b64decode(s).encode('UTF-8')
def process_body(body):
new_body = []
content_buffer = []
for line in body.split('\n'):
if not line:
new_body = new_body + content_buffer + [ line ]
content_buffer = []
elif line.strip()[0] == '>':
content_buffer = []
else:
content_buffer.append(line)
new_body = new_body + content_buffer
return '\n'.join(new_body).strip()
def fetch_wavelet(wave_id, wavelet_id, participant):
from notifiy.robot import create_robot
robot = create_robot(run=False, domain=participant.split('@')[1])
# TODO return robot.fetch_wavelet(wave_id, wavelet_id, participant)
return robot.fetch_wavelet(wave_id, wavelet_id)
def reply_wavelet(wave_id, wavelet_id, blip_id, participant, message):
wavelet = fetch_wavelet(wave_id, wavelet_id, participant)
body = '%s: %s' % (participant, message) # TODO remove when proxy_for works
if blip_id in wavelet.blips:
blip = wavelet.blips[blip_id]
blip = blip.reply()
blip.append(body)
else:
blip = wavelet.reply(body)
wavelet.robot.submit(wavelet)
from notifiy import notifications
notifications.notify_submitted(wavelet, blip, participant, message)
| ajibawa-2023/Python-Code-Large/train/row_1098 | 46 | 73 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Import_L3_C0", "label": "base64 import base64", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0411, 0.0137, 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_1098:Import_L4_C0", "label": "urllib import urllib", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0548, 0.0137, 0, 0.66, 0.1429, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "label": "get_url", "type": "function", "loc": [7, 17], "level": 0, "parent": null, "vector": [2, 0, 0.1644, 0.1507, 0, 0.66, 0.2857, 662, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_url", "arg_names": ["participant", "wave_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_url(participant, wave_id):\n domain = participant.split('@')[1]\n if wave_id:\n wave_id = urllib.quote(urllib.quote(wave_id))\n\n if wave_id and domain == 'googlewave.com':\n return 'https://wave.google.com/wave/#restored:wave:%s' % wave_id\n elif wave_id:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L8_C4", "label": "domain =", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "vector": [14, 1, 0.1096, 0.0137, 1, 0.41, 0.0, 438, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " domain = participant.split('@')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L9_C4", "label": "if", "type": "if", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "vector": [4, 1, 0.1301, 0.0274, 1, 0.41, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wave_id:\n wave_id = urllib.quote(urllib.quote(wave_id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L10_C8", "label": "wave_id = quote()", "type": "assigned_variable", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L9_C4", "vector": [14, 2, 0.137, 0.0137, 2, 0.18, 0.0, 347, 3, 1, 0, 0, 79, 10, 2], "semantic": {"name": "wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "quote", "annotation": ""}, "snippet": " wave_id = urllib.quote(urllib.quote(wave_id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4", "label": "if", "type": "if", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "vector": [4, 1, 0.1986, 0.0822, 1, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wave_id and domain == 'googlewave.com':\n return 'https://wave.google.com/wave/#restored:wave:%s' % wave_id\n elif wave_id:\n return 'https://wave.google.com/a/%s/#restored:wave:%s' % (wave_id, domain)\n else:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L13_C8", "label": "return", "type": "return", "loc": [13, 13], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4", "vector": [13, 2, 0.1781, 0.0137, 2, 0.23, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'https://wave.google.com/wave/#restored:wave:%s' % wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4", "label": "if", "type": "if", "loc": [14, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4", "vector": [4, 2, 0.2123, 0.0548, 2, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif wave_id:\n return 'https://wave.google.com/a/%s/#restored:wave:%s' % (wave_id, domain)\n else:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L15_C8", "label": "return", "type": "return", "loc": [15, 15], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4", "vector": [13, 3, 0.2055, 0.0137, 3, 0.71, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'https://wave.google.com/a/%s/#restored:wave:%s' % (wave_id, domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4", "vector": [13, 3, 0.2329, 0.0137, 3, 0.71, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L20_C0", "label": "modified_b64encode", "type": "function", "loc": [20, 24], "level": 0, "parent": null, "vector": [2, 0, 0.3014, 0.0685, 0, 0.66, 0.4286, 678, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "modified_b64encode", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modified_b64encode(s):\n if type(s) == unicode:\n s = s.decode('UTF-8')\n\n return base64.urlsafe_b64encode(s).replace('=', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L20_C0", "vector": [4, 1, 0.2945, 0.0274, 1, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(s) == unicode:\n s = s.decode('UTF-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L22_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L21_C4", "vector": [14, 2, 0.3014, 0.0137, 2, 0.29, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('UTF-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L24_C4", "label": "return", "type": "return", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L20_C0", "vector": [13, 1, 0.3288, 0.0137, 1, 0.25, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base64.urlsafe_b64encode(s).replace('=', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L27_C0", "label": "modified_b64decode", "type": "function", "loc": [27, 31], "level": 0, "parent": null, "vector": [2, 0, 0.3973, 0.0685, 0, 0.66, 0.5714, 936, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "modified_b64decode", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def modified_b64decode(s):\n while len(s) % 4 != 0:\n s = s + '='\n\n return base64.urlsafe_b64decode(s).encode('UTF-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:While_L28_C4", "label": "while", "type": "while", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L27_C0", "vector": [5, 1, 0.3904, 0.0274, 1, 0.07, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(s) % 4 != 0:\n s = s + '='"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L29_C8", "label": "s =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:While_L28_C4", "vector": [14, 2, 0.3973, 0.0137, 2, 0.68, 0.0, 553, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s = s + '='"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L31_C4", "label": "return", "type": "return", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L27_C0", "vector": [13, 1, 0.4247, 0.0137, 1, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return base64.urlsafe_b64decode(s).encode('UTF-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "label": "process_body", "type": "function", "loc": [34, 49], "level": 0, "parent": null, "vector": [2, 0, 0.5685, 0.2192, 0, 0.66, 0.7143, 699, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "process_body", "arg_names": ["body"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def process_body(body):\n new_body = []\n content_buffer = []\n\n for line in body.split('\\n'):\n if not line:\n new_body = new_body + content_buffer + [ line ]\n content_buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L35_C4", "label": "new_body =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "vector": [14, 1, 0.4795, 0.0137, 1, 0.65, 0.0, 599, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_body = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L36_C4", "label": "content_buffer =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "vector": [14, 1, 0.4932, 0.0137, 1, 0.65, 0.25, 193, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "content_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:For_L38_C4", "label": "for line", "type": "for", "loc": [38, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "vector": [6, 1, 0.5685, 0.1096, 1, 0.65, 0.5, 373, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in body.split('\\n'):\n if not line:\n new_body = new_body + content_buffer + [ line ]\n content_buffer = []\n elif line.strip()[0] == '>':\n content_buffer = []\n else:\n content_buffer.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "label": "if", "type": "if", "loc": [39, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:For_L38_C4", "vector": [4, 2, 0.5753, 0.0959, 2, 0.1, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not line:\n new_body = new_body + content_buffer + [ line ]\n content_buffer = []\n elif line.strip()[0] == '>':\n content_buffer = []\n else:\n content_buffer.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L40_C12", "label": "new_body =", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "vector": [14, 3, 0.5479, 0.0137, 3, 0.09, 0.0, 599, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_body = new_body + content_buffer + [ line ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L41_C12", "label": "content_buffer =", "type": "assigned_variable", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "vector": [14, 3, 0.5616, 0.0137, 3, 0.09, 0.5, 193, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "content_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8", "label": "if", "type": "if", "loc": [42, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "vector": [4, 3, 0.5959, 0.0548, 3, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line.strip()[0] == '>':\n content_buffer = []\n else:\n content_buffer.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L43_C12", "label": "content_buffer =", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8", "vector": [14, 4, 0.589, 0.0137, 4, 0.69, 0.0, 193, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "content_buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L45_C12", "label": "append()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8", "vector": [8, 4, 0.6164, 0.0137, 4, 0.69, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content_buffer.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L47_C4", "label": "new_body =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "vector": [14, 1, 0.6438, 0.0137, 1, 0.65, 0.75, 599, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_body = new_body + content_buffer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L49_C4", "label": "return", "type": "return", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "vector": [13, 1, 0.6712, 0.0137, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'.join(new_body).strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "label": "fetch_wavelet", "type": "function", "loc": [52, 57], "level": 0, "parent": null, "vector": [2, 0, 0.7466, 0.0822, 0, 0.66, 0.8571, 327, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "fetch_wavelet", "arg_names": ["wave_id", "wavelet_id", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fetch_wavelet(wave_id, wavelet_id, participant):\n from notifiy.robot import create_robot\n robot = create_robot(run=False, domain=participant.split('@')[1])\n\n # TODO return robot.fetch_wavelet(wave_id, wavelet_id, participant)\n return robot.fetch_wavelet(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:ImportFrom_L53_C4", "label": "from notifiy.robot import create_robot", "type": "import", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "vector": [1, 1, 0.726, 0.0137, 1, 0.08, 0.0, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "notifiy.robot", "arg_names": [], "import_names": ["create_robot"], "rhs_call_name": "", "annotation": ""}, "snippet": " from notifiy.robot import create_robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L54_C4", "label": "robot = create_robot()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "vector": [14, 1, 0.7397, 0.0137, 1, 0.08, 0.5, 735, 3, 2, 0, 0, 641, 10, 2], "semantic": {"name": "robot", "arg_names": [], "import_names": [], "rhs_call_name": "create_robot", "annotation": ""}, "snippet": " robot = create_robot(run=False, domain=participant.split('@')[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "vector": [13, 1, 0.7808, 0.0137, 1, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return robot.fetch_wavelet(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "label": "reply_wavelet", "type": "function", "loc": [60, 73], "level": 0, "parent": null, "vector": [2, 0, 0.911, 0.1918, 0, 0.66, 1.0, 478, 0, 5, 0, 0, 0, 0, 6], "semantic": {"name": "reply_wavelet", "arg_names": ["wave_id", "wavelet_id", "blip_id", "participant", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def reply_wavelet(wave_id, wavelet_id, blip_id, participant, message):\n wavelet = fetch_wavelet(wave_id, wavelet_id, participant)\n body = '%s: %s' % (participant, message) # TODO remove when proxy_for works\n if blip_id in wavelet.blips:\n blip = wavelet.blips[blip_id]\n blip = blip.reply()\n blip.append(body)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L61_C4", "label": "wavelet = fetch_wavelet()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [14, 1, 0.8356, 0.0137, 1, 0.84, 0.0, 147, 3, 3, 0, 0, 327, 10, 1], "semantic": {"name": "wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_wavelet", "annotation": ""}, "snippet": " wavelet = fetch_wavelet(wave_id, wavelet_id, participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L62_C4", "label": "body =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [14, 1, 0.8493, 0.0137, 1, 0.84, 0.2, 477, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " body = '%s: %s' % (participant, message) # TODO remove when proxy_for works"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "label": "if", "type": "if", "loc": [63, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [4, 1, 0.8973, 0.0822, 1, 0.84, 0.4, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if blip_id in wavelet.blips:\n blip = wavelet.blips[blip_id]\n blip = blip.reply()\n blip.append(body)\n else:\n blip = wavelet.reply(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L64_C8", "label": "blip =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "vector": [14, 2, 0.8767, 0.0137, 2, 0.51, 0.0, 134, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip = wavelet.blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L65_C8", "label": "blip = reply()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "vector": [14, 2, 0.8904, 0.0137, 2, 0.51, 0.3333, 134, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " blip = blip.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L66_C8", "label": "append()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "vector": [8, 2, 0.9041, 0.0137, 2, 0.51, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L68_C8", "label": "blip = reply()", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "vector": [14, 2, 0.9315, 0.0137, 2, 0.51, 1.0, 134, 3, 1, 0, 0, 714, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " blip = wavelet.reply(body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L70_C4", "label": "submit()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [8, 1, 0.9589, 0.0137, 1, 0.84, 0.6, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "submit", "arg_names": [], "import_names": [], "rhs_call_name": "submit", "annotation": ""}, "snippet": " wavelet.robot.submit(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:ImportFrom_L72_C4", "label": "from notifiy import notifications", "type": "import", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [1, 1, 0.9863, 0.0137, 1, 0.84, 0.8, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["notifications"], "rhs_call_name": "", "annotation": ""}, "snippet": " from notifiy import notifications"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L73_C4", "label": "notify_submitted()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "vector": [8, 1, 1.0, 0.0137, 1, 0.84, 1.0, 798, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "notify_submitted", "arg_names": [], "import_names": [], "rhs_call_name": "notify_submitted", "annotation": ""}, "snippet": " notifications.notify_submitted(wavelet, blip, participant, message)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L13_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L14_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:While_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:While_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:For_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:For_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L41_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L42_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:ImportFrom_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:If_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:ImportFrom_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1098:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1098:Expr_L73_C4"}] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import urllib
import datetime
from google.appengine.ext import webapp
from google.appengine.ext import deferred
from waveapi import simplejson
from notifiy import model
from notifiy import general
from notifiy import preferences
from notifiy.robot import create_robot
class Process(webapp.RequestHandler):
def get(self):
self.response.contentType = 'application/json'
path = [urllib.unquote(a) for a in self.request.path.split('/')[2:]]
notification_type = path[0]
if not hasattr(self, notification_type): return
self.participant = self.request.get('participant')
self.wave_id = self.request.get('wave_id')
getattr(self, notification_type)()
def status(self):
self.toggle(False)
def toggle(self, toggle=True):
pp = model.ParticipantPreferences.get_by_pk(self.participant)
pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id, create=toggle)
data = ''
if pwp:
if toggle:
pwp.notify_type = (pwp.notify_type + 1) % model.NOTIFY_TYPE_COUNT
pwp.put()
status = pwp.notify_type
email = pwp.notify_type
phones = [ 1 ] # TODO count phones
if len(phones) == 0:
phone = -1
if pwp.notify_type != model.NOTIFY_NONE:
phone = model.NOTIFY_ONCE
else:
phone = model.NOTIFY_NONE
data = simplejson.dumps({ 'status': status,
'email': email,
'phone': phone,
'preferencesWaveId': pp and pp.preferences_wave_id or '' })
else:
data = simplejson.dumps({ 'status': 0,
'email': 0,
'phone': 0,
'preferencesWaveId': pp and pp.preferences_wave_id or '' })
self.response.out.write(data);
def offline(self):
self.online(False)
def online(self, online=True):
pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id)
if pwp:
pwp.last_visited = datetime.datetime.now()
pwp.put()
if not online:
visited(pwp.participant, self.wave_id, pwp)
else:
deferred.defer(visited, pwp.participant, pwp.wave_id,
pwp.last_visited, _queue='visited', _countdown=150)
self.response.out.write(simplejson.dumps({ 'status': 0 }))
def reset(self):
domain = self.participant.split('@')[1]
robot = create_robot(run=False, domain=domain)
preferences.create_preferences_wave(robot, self.participant)
#wavelet = robot.fetch_wavelet(self.wave_id, '%s!root+conv' % domain)
#general.participant_init(wavelet, self.participant)
#general.participant_wavelet_init(wavelet, self.participant, self.participant)
self.response.out.write(simplejson.dumps({ 'status': 0 }))
def confirm(self):
email = self.request.get('email')
activation = self.request.get('activation')
def visited(participant, wave_id=None, last_visited=None):
if not wave_id: return
pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)
if pwp.last_visited == last_visited:
pwp.visited = True
pwp.put()
| ajibawa-2023/Python-Code-Large/train/row_1099 | 66 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Import_L4_C0", "label": "urllib import urllib", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0381, 0.0095, 0, 0.66, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Import_L5_C0", "label": "datetime import datetime", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0476, 0.0095, 0, 0.66, 0.1, 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_1099:ImportFrom_L7_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0095, 0, 0.66, 0.2, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L8_C0", "label": "from google.appengine.ext import deferred", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0762, 0.0095, 0, 0.66, 0.3, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["deferred"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import deferred"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L10_C0", "label": "from waveapi import simplejson", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0952, 0.0095, 0, 0.66, 0.4, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "waveapi", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L12_C0", "label": "from notifiy import model", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1143, 0.0095, 0, 0.66, 0.5, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L13_C0", "label": "from notifiy import general", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1238, 0.0095, 0, 0.66, 0.6, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["general"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import general"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L14_C0", "label": "from notifiy import preferences", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1333, 0.0095, 0, 0.66, 0.7, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["preferences"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import preferences"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ImportFrom_L15_C0", "label": "from notifiy.robot import create_robot", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0095, 0, 0.66, 0.8, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "notifiy.robot", "arg_names": [], "import_names": ["create_robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.robot import create_robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "label": "Process", "type": "class", "loc": [18, 97], "level": 0, "parent": null, "vector": [3, 0, 0.5476, 0.7619, 0, 0.66, 0.9, 303, 0, 7, 0, 0, 256, 0, 30], "semantic": {"name": "Process", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Process(webapp.RequestHandler):\n\n def get(self):\n self.response.contentType = 'application/json'\n\n path = [urllib.unquote(a) for a in self.request.path.split('/')[2:]]\n notification_type = path[0]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "label": "get", "type": "function", "loc": [20, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.2429, 0.1143, 1, 0.12, 0.0, 607, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n self.response.contentType = 'application/json'\n\n path = [urllib.unquote(a) for a in self.request.path.split('/')[2:]]\n notification_type = path[0]\n\n if not hasattr(self, notification_type): return\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L21_C8", "label": "self.response.contentType =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [14, 2, 0.2, 0.0095, 2, 0.12, 0.0, 876, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.response.contentType", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.contentType = 'application/json'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L23_C8", "label": "path =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [14, 2, 0.219, 0.0095, 2, 0.12, 0.1667, 358, 5, 0, 0, 0, 0, 0, 2], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = [urllib.unquote(a) for a in self.request.path.split('/')[2:]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L24_C8", "label": "notification_type =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [14, 2, 0.2286, 0.0095, 2, 0.12, 0.3333, 602, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "notification_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " notification_type = path[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L26_C8", "label": "if", "type": "if", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [4, 2, 0.2476, 0.0095, 2, 0.12, 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, notification_type): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Return_L26_C49", "label": "return", "type": "return", "loc": [26, 26], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L26_C8", "vector": [13, 3, 0.2476, 0.0095, 3, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hasattr(self, notification_type): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L28_C8", "label": "self.participant = get()", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [14, 2, 0.2667, 0.0095, 2, 0.12, 0.6667, 149, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.participant", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.participant = self.request.get('participant')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L29_C8", "label": "self.wave_id = get()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [14, 2, 0.2762, 0.0095, 2, 0.12, 0.8333, 647, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.wave_id = self.request.get('wave_id')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L31_C8", "label": "expression", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "vector": [8, 2, 0.2952, 0.0095, 2, 0.12, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " getattr(self, notification_type)()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L33_C4", "label": "status", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.319, 0.019, 1, 0.12, 0.1667, 699, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "status", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def status(self):\n self.toggle(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L34_C8", "label": "toggle()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L33_C4", "vector": [8, 2, 0.3238, 0.0095, 2, 0.98, 0.0, 316, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "toggle", "arg_names": [], "import_names": [], "rhs_call_name": "toggle", "annotation": ""}, "snippet": " self.toggle(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "label": "toggle", "type": "function", "loc": [36, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.4762, 0.2762, 1, 0.12, 0.3333, 316, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "toggle", "arg_names": ["self", "toggle"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def toggle(self, toggle=True):\n pp = model.ParticipantPreferences.get_by_pk(self.participant)\n pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id, create=toggle)\n data = ''\n\n if pwp:\n if toggle:\n pwp.notify_type = (pwp.notify_type + 1) % model.NOTIFY_TYPE_COUNT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L37_C8", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "vector": [14, 2, 0.3524, 0.0095, 2, 0.61, 0.0, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(self.participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L38_C8", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "vector": [14, 2, 0.3619, 0.0095, 2, 0.61, 0.25, 506, 3, 3, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id, create=toggle)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L39_C8", "label": "data =", "type": "assigned_variable", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "vector": [14, 2, 0.3714, 0.0095, 2, 0.61, 0.5, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "label": "if", "type": "if", "loc": [41, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "vector": [4, 2, 0.4905, 0.2095, 2, 0.61, 0.75, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp:\n if toggle:\n pwp.notify_type = (pwp.notify_type + 1) % model.NOTIFY_TYPE_COUNT\n pwp.put()\n status = pwp.notify_type\n email = pwp.notify_type\n phones = [ 1 ] # TODO count phones\n if len(phones) == 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12", "label": "if", "type": "if", "loc": [42, 44], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [4, 3, 0.4095, 0.0286, 3, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if toggle:\n pwp.notify_type = (pwp.notify_type + 1) % model.NOTIFY_TYPE_COUNT\n pwp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L43_C16", "label": "pwp.notify_type =", "type": "assigned_variable", "loc": [43, 43], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12", "vector": [14, 4, 0.4095, 0.0095, 4, 0.05, 0.0, 455, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pwp.notify_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwp.notify_type = (pwp.notify_type + 1) % model.NOTIFY_TYPE_COUNT"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L44_C16", "label": "put()", "type": "expression", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12", "vector": [8, 4, 0.419, 0.0095, 4, 0.05, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pwp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L45_C12", "label": "status =", "type": "assigned_variable", "loc": [45, 45], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [14, 3, 0.4286, 0.0095, 3, 0.38, 0.1429, 699, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = pwp.notify_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L46_C12", "label": "email =", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [14, 3, 0.4381, 0.0095, 3, 0.38, 0.2857, 413, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " email = pwp.notify_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L47_C12", "label": "phones =", "type": "assigned_variable", "loc": [47, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [14, 3, 0.4476, 0.0095, 3, 0.38, 0.4286, 67, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "phones", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " phones = [ 1 ] # TODO count phones"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L48_C12", "label": "if", "type": "if", "loc": [48, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [4, 3, 0.4619, 0.019, 3, 0.38, 0.5714, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(phones) == 0:\n phone = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L49_C16", "label": "phone =", "type": "assigned_variable", "loc": [49, 49], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L48_C12", "vector": [14, 4, 0.4667, 0.0095, 4, 0.1, 0.0, 193, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "phone", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " phone = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12", "label": "if", "type": "if", "loc": [50, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [4, 3, 0.4905, 0.0381, 3, 0.38, 0.7143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp.notify_type != model.NOTIFY_NONE:\n phone = model.NOTIFY_ONCE\n else:\n phone = model.NOTIFY_NONE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L51_C16", "label": "phone =", "type": "assigned_variable", "loc": [51, 51], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12", "vector": [14, 4, 0.4857, 0.0095, 4, 0.89, 0.0, 193, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "phone", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " phone = model.NOTIFY_ONCE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L53_C16", "label": "phone =", "type": "assigned_variable", "loc": [53, 53], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12", "vector": [14, 4, 0.5048, 0.0095, 4, 0.89, 1.0, 193, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "phone", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " phone = model.NOTIFY_NONE"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L54_C12", "label": "data = dumps()", "type": "assigned_variable", "loc": [54, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [14, 3, 0.5286, 0.0381, 3, 0.38, 0.8571, 929, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " data = simplejson.dumps({ 'status': status,\n 'email': email,\n 'phone': phone,\n 'preferencesWaveId': pp and pp.preferences_wave_id or '' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L59_C12", "label": "data = dumps()", "type": "assigned_variable", "loc": [59, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "vector": [14, 3, 0.5762, 0.0381, 3, 0.38, 1.0, 929, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " data = simplejson.dumps({ 'status': 0,\n 'email': 0,\n 'phone': 0,\n 'preferencesWaveId': pp and pp.preferences_wave_id or '' })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L64_C8", "label": "write()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "vector": [8, 2, 0.6095, 0.0095, 2, 0.61, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(data);"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L66_C4", "label": "offline", "type": "function", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.6333, 0.019, 1, 0.12, 0.5, 514, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "offline", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def offline(self):\n self.online(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L67_C8", "label": "online()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L66_C4", "vector": [8, 2, 0.6381, 0.0095, 2, 0.31, 0.0, 831, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "online", "arg_names": [], "import_names": [], "rhs_call_name": "online", "annotation": ""}, "snippet": " self.online(False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "label": "online", "type": "function", "loc": [69, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.7143, 0.1238, 1, 0.12, 0.6667, 831, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "online", "arg_names": ["self", "online"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def online(self, online=True):\n pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id)\n\n if pwp:\n pwp.last_visited = datetime.datetime.now()\n pwp.put()\n if not online:\n visited(pwp.participant, self.wave_id, pwp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L70_C8", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "vector": [14, 2, 0.6667, 0.0095, 2, 0.0, 0.0, 506, 3, 2, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(self.participant, self.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "label": "if", "type": "if", "loc": [72, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "vector": [4, 2, 0.719, 0.0762, 2, 0.0, 0.5, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp:\n pwp.last_visited = datetime.datetime.now()\n pwp.put()\n if not online:\n visited(pwp.participant, self.wave_id, pwp)\n else:\n deferred.defer(visited, pwp.participant, pwp.wave_id,\n pwp.last_visited, _queue='visited', _countdown=150)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L73_C12", "label": "pwp.last_visited = now()", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "vector": [14, 3, 0.6952, 0.0095, 3, 0.28, 0.0, 152, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "pwp.last_visited", "arg_names": [], "import_names": [], "rhs_call_name": "now", "annotation": ""}, "snippet": " pwp.last_visited = datetime.datetime.now()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L74_C12", "label": "put()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "vector": [8, 3, 0.7048, 0.0095, 3, 0.28, 0.5, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pwp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12", "label": "if", "type": "if", "loc": [75, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "vector": [4, 3, 0.7333, 0.0476, 3, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not online:\n visited(pwp.participant, self.wave_id, pwp)\n else:\n deferred.defer(visited, pwp.participant, pwp.wave_id,\n pwp.last_visited, _queue='visited', _countdown=150)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L76_C16", "label": "visited()", "type": "expression", "loc": [76, 76], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12", "vector": [8, 4, 0.7238, 0.0095, 4, 0.02, 0.0, 574, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "visited", "arg_names": [], "import_names": [], "rhs_call_name": "visited", "annotation": ""}, "snippet": " visited(pwp.participant, self.wave_id, pwp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L78_C16", "label": "defer()", "type": "expression", "loc": [78, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12", "vector": [8, 4, 0.7476, 0.019, 4, 0.02, 1.0, 826, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "defer", "arg_names": [], "import_names": [], "rhs_call_name": "defer", "annotation": ""}, "snippet": " deferred.defer(visited, pwp.participant, pwp.wave_id,\n pwp.last_visited, _queue='visited', _countdown=150)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L81_C8", "label": "write()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "vector": [8, 2, 0.7714, 0.0095, 2, 0.0, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(simplejson.dumps({ 'status': 0 }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "label": "reset", "type": "function", "loc": [83, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.8381, 0.1048, 1, 0.12, 0.8333, 944, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reset(self):\n domain = self.participant.split('@')[1]\n robot = create_robot(run=False, domain=domain)\n\n preferences.create_preferences_wave(robot, self.participant)\n\n #wavelet = robot.fetch_wavelet(self.wave_id, '%s!root+conv' % domain)\n #general.participant_init(wavelet, self.participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L84_C8", "label": "domain =", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "vector": [14, 2, 0.8, 0.0095, 2, 0.73, 0.0, 438, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " domain = self.participant.split('@')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L85_C8", "label": "robot = create_robot()", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "vector": [14, 2, 0.8095, 0.0095, 2, 0.73, 0.3333, 735, 3, 2, 0, 0, 641, 10, 1], "semantic": {"name": "robot", "arg_names": [], "import_names": [], "rhs_call_name": "create_robot", "annotation": ""}, "snippet": " robot = create_robot(run=False, domain=domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L87_C8", "label": "create_preferences_wave()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "vector": [8, 2, 0.8286, 0.0095, 2, 0.73, 0.6667, 622, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_preferences_wave", "arg_names": [], "import_names": [], "rhs_call_name": "create_preferences_wave", "annotation": ""}, "snippet": " preferences.create_preferences_wave(robot, self.participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L93_C8", "label": "write()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "vector": [8, 2, 0.8857, 0.0095, 2, 0.73, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(simplejson.dumps({ 'status': 0 }))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4", "label": "confirm", "type": "function", "loc": [95, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "vector": [2, 1, 0.9143, 0.0286, 1, 0.12, 1.0, 488, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "confirm", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def confirm(self):\n email = self.request.get('email')\n activation = self.request.get('activation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L96_C8", "label": "email = get()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4", "vector": [14, 2, 0.9143, 0.0095, 2, 0.71, 0.0, 413, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " email = self.request.get('email')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L97_C8", "label": "activation = get()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4", "vector": [14, 2, 0.9238, 0.0095, 2, 0.71, 1.0, 102, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "activation", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " activation = self.request.get('activation')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "label": "visited", "type": "function", "loc": [100, 105], "level": 0, "parent": null, "vector": [2, 0, 0.9762, 0.0571, 0, 0.66, 1.0, 574, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "visited", "arg_names": ["participant", "wave_id", "last_visited"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def visited(participant, wave_id=None, last_visited=None):\n if not wave_id: return\n pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)\n if pwp.last_visited == last_visited:\n pwp.visited = True\n pwp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L101_C4", "label": "if", "type": "if", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "vector": [4, 1, 0.9619, 0.0095, 1, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wave_id: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Return_L101_C20", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L101_C4", "vector": [13, 2, 0.9619, 0.0095, 2, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wave_id: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L102_C4", "label": "pwp = get_by_pk()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "vector": [14, 1, 0.9714, 0.0095, 1, 0.25, 0.5, 506, 3, 2, 0, 0, 243, 10, 1], "semantic": {"name": "pwp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pwp = model.ParticipantWavePreferences.get_by_pk(participant, wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4", "label": "if", "type": "if", "loc": [103, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "vector": [4, 1, 0.9905, 0.0286, 1, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pwp.last_visited == last_visited:\n pwp.visited = True\n pwp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L104_C8", "label": "pwp.visited =", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4", "vector": [14, 2, 0.9905, 0.0095, 2, 0.45, 0.0, 467, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "pwp.visited", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pwp.visited = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L105_C8", "label": "put()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4", "vector": [8, 2, 1.0, 0.0095, 2, 0.45, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pwp.put()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Return_L26_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L38_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L43_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L42_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L45_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L47_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L48_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L48_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L49_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L51_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L50_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L53_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L67_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L73_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L74_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L72_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L76_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L75_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L78_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L84_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L85_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L87_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L101_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Return_L101_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:FunctionDef_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Assign_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1099:If_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1099:Expr_L105_C8"}] |
# -*- coding: UTF-8 -*-
ME = 'cesar.izurieta@googlewave.com'
ROBOT_NAME = 'notifiy'
ROBOT_ID = 'wave-email-notifications'
ROBOT_ADDRESS = '%s@appspot.com' % ROBOT_ID
ROBOT_BASE_URL = 'http://%s.appspot.com' % ROBOT_ID
ROBOT_EMAIL = '%s@ecuarock.net' % ROBOT_ID
ROBOT_HOME_PAGE = 'http://%s.googlecode.com' % ROBOT_ID
ROBOT_IMG = '%s/%s' % (ROBOT_BASE_URL, 'favicon.png')
ROBOT_LOGO = '%s/%s' % (ROBOT_BASE_URL, 'logo.png')
RPC_URL = {
'googlewave.com': 'http://gmodules.com/api/rpc',
'wavesandbox.com': 'http://sandbox.gmodules.com/api/rpc'
}
| ajibawa-2023/Python-Code-Large/train/row_1102 | 10 | 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_1102:Assign_L3_C0", "label": "ME =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.1765, 0.0588, 0, 0.66, 0.0, 917, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ME = 'cesar.izurieta@googlewave.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L5_C0", "label": "ROBOT_NAME =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.2941, 0.0588, 0, 0.66, 0.1111, 987, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_NAME = 'notifiy'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L6_C0", "label": "ROBOT_ID =", "type": "assigned_variable", "loc": [6, 6], "level": 0, "parent": null, "vector": [14, 0, 0.3529, 0.0588, 0, 0.66, 0.2222, 733, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_ID = 'wave-email-notifications'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L7_C0", "label": "ROBOT_ADDRESS =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.4118, 0.0588, 0, 0.66, 0.3333, 694, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_ADDRESS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_ADDRESS = '%s@appspot.com' % ROBOT_ID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L8_C0", "label": "ROBOT_BASE_URL =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.4706, 0.0588, 0, 0.66, 0.4444, 874, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_BASE_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_BASE_URL = 'http://%s.appspot.com' % ROBOT_ID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L9_C0", "label": "ROBOT_EMAIL =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.5294, 0.0588, 0, 0.66, 0.5556, 271, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_EMAIL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_EMAIL = '%s@ecuarock.net' % ROBOT_ID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L10_C0", "label": "ROBOT_HOME_PAGE =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.5882, 0.0588, 0, 0.66, 0.6667, 540, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_HOME_PAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_HOME_PAGE = 'http://%s.googlecode.com' % ROBOT_ID"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L11_C0", "label": "ROBOT_IMG =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.6471, 0.0588, 0, 0.66, 0.7778, 656, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_IMG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_IMG = '%s/%s' % (ROBOT_BASE_URL, 'favicon.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L12_C0", "label": "ROBOT_LOGO =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.7059, 0.0588, 0, 0.66, 0.8889, 883, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ROBOT_LOGO", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_LOGO = '%s/%s' % (ROBOT_BASE_URL, 'logo.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1102:Assign_L14_C0", "label": "RPC_URL =", "type": "assigned_variable", "loc": [14, 17], "level": 0, "parent": null, "vector": [14, 0, 0.9118, 0.2353, 0, 0.66, 1.0, 595, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "RPC_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RPC_URL = {\n 'googlewave.com': 'http://gmodules.com/api/rpc',\n 'wavesandbox.com': 'http://sandbox.gmodules.com/api/rpc'\n}"}] | [] |
# -*- coding: UTF-8 -*-
import logging
from waveapi import appengine_robot_runner
from waveapi import events
from waveapi.robot import Robot
from notifiy import constants
from notifiy import model
from notifiy import notifications
from notifiy import preferences
from notifiy import templates
from notifiy import general
###################################################
# General handlers
###################################################
def on_wavelet_self_added(event, wavelet):
if preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
general.wavelet_init(wavelet, event.modified_by)
def on_wavelet_self_removed(event, wavelet):
if preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
general.wavelet_deinit(wavelet)
def on_wavelet_participants_changed(event, wavelet):
if preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:
general.wavelet_init(wavelet, event.modified_by)
message = templates.ADDED_MESSAGE % event.modified_by
for participant in event.participants_added:
general.participant_wavelet_init(wavelet, participant,
event.modified_by, message)
###################################################
# Content change handlers
###################################################
def on_blip_submitted(event, wavelet):
if preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:
general.wavelet_init(wavelet, event.modified_by)
notifications.notify_submitted(wavelet, event.blip, event.modified_by)
def on_wavelet_blip_removed(event, wavelet):
if preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:
general.wavelet_init(wavelet, event.modified_by)
notifications.notify_removed(wavelet, event.modified_by)
###################################################
# Preferences handlers
###################################################
def on_form_button_clicked(event, wavelet):
if not preferences.is_preferences_wave(wavelet): return
logging.info('%s called', event.type)
setup_oauth(wavelet.robot, wavelet.domain)
preferences.handle_event(event, wavelet)
###################################################
# Main functions
###################################################
def create_robot(run=True, domain=None):
robot = Robot(constants.ROBOT_NAME.title(), image_url=constants.ROBOT_IMG,
profile_url=constants.ROBOT_BASE_URL)
robot.register_handler(events.WaveletSelfAdded, on_wavelet_self_added, context=[ events.Context.ROOT ])
robot.register_handler(events.WaveletSelfRemoved, on_wavelet_self_removed, context=[ events.Context.ROOT ])
robot.register_handler(events.WaveletParticipantsChanged, on_wavelet_participants_changed, context=[ events.Context.ROOT ])
robot.register_handler(events.BlipSubmitted, on_blip_submitted, context=[ events.Context.SELF ])
robot.register_handler(events.WaveletBlipRemoved, on_wavelet_blip_removed, context=[ events.Context.SELF ])
robot.register_handler(events.FormButtonClicked, on_form_button_clicked, context=[ events.Context.ALL ])
# Needed to reauthenticate robot
# verification_token = model.ApplicationSettings.get("verification-token")
# security_token = model.ApplicationSettings.get("security-token")
# robot.set_verification_token_info(verification_token, security_token)
if domain:
setup_oauth(robot, domain)
if run:
appengine_robot_runner.run(robot)
return robot
def setup_oauth(robot, domain):
consumer_key = model.ApplicationSettings.get("consumer-key")
consumer_secret = model.ApplicationSettings.get("consumer-secret")
if domain in constants.RPC_URL:
url = constants.RPC_URL[domain]
else:
url = constants.RPC_URL['googlewave.com'] # TODO
robot.setup_oauth(consumer_key, consumer_secret, url)
| ajibawa-2023/Python-Code-Large/train/row_1103 | 74 | 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_1103:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0234, 0.0078, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L5_C0", "label": "from waveapi import appengine_robot_runner", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0391, 0.0078, 0, 0.66, 0.0588, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "waveapi", "arg_names": [], "import_names": ["appengine_robot_runner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi import appengine_robot_runner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L6_C0", "label": "from waveapi import events", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0469, 0.0078, 0, 0.66, 0.1176, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "waveapi", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L7_C0", "label": "from waveapi.robot import Robot", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0547, 0.0078, 0, 0.66, 0.1765, 11, 0, 1, 0, 0, 11, 0, 0], "semantic": {"name": "waveapi.robot", "arg_names": [], "import_names": ["Robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi.robot import Robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L9_C0", "label": "from notifiy import constants", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0703, 0.0078, 0, 0.66, 0.2353, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["constants"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import constants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L10_C0", "label": "from notifiy import model", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0781, 0.0078, 0, 0.66, 0.2941, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L11_C0", "label": "from notifiy import notifications", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.0859, 0.0078, 0, 0.66, 0.3529, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["notifications"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import notifications"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L12_C0", "label": "from notifiy import preferences", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0078, 0, 0.66, 0.4118, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["preferences"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import preferences"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L13_C0", "label": "from notifiy import templates", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.1016, 0.0078, 0, 0.66, 0.4706, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["templates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import templates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:ImportFrom_L14_C0", "label": "from notifiy import general", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1094, 0.0078, 0, 0.66, 0.5294, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["general"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import general"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "label": "on_wavelet_self_added", "type": "function", "loc": [21, 26], "level": 0, "parent": null, "vector": [2, 0, 0.1836, 0.0469, 0, 0.66, 0.5882, 697, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "on_wavelet_self_added", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_wavelet_self_added(event, wavelet):\n if preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L22_C4", "label": "if", "type": "if", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "vector": [4, 1, 0.1719, 0.0078, 1, 0.76, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L22_C49", "label": "return", "type": "return", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L22_C4", "vector": [13, 2, 0.1719, 0.0078, 2, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L23_C4", "label": "info()", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "vector": [8, 1, 0.1797, 0.0078, 1, 0.76, 0.3333, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L24_C4", "label": "setup_oauth()", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "vector": [8, 1, 0.1875, 0.0078, 1, 0.76, 0.6667, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L26_C4", "label": "wavelet_init()", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "vector": [8, 1, 0.2031, 0.0078, 1, 0.76, 1.0, 515, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_init", "annotation": ""}, "snippet": " general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "label": "on_wavelet_self_removed", "type": "function", "loc": [29, 34], "level": 0, "parent": null, "vector": [2, 0, 0.2461, 0.0469, 0, 0.66, 0.6471, 421, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "on_wavelet_self_removed", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_wavelet_self_removed(event, wavelet):\n if preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n general.wavelet_deinit(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L30_C4", "label": "if", "type": "if", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "vector": [4, 1, 0.2344, 0.0078, 1, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L30_C49", "label": "return", "type": "return", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L30_C4", "vector": [13, 2, 0.2344, 0.0078, 2, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L31_C4", "label": "info()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "vector": [8, 1, 0.2422, 0.0078, 1, 0.8, 0.3333, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L32_C4", "label": "setup_oauth()", "type": "expression", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "vector": [8, 1, 0.25, 0.0078, 1, 0.8, 0.6667, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L34_C4", "label": "wavelet_deinit()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "vector": [8, 1, 0.2656, 0.0078, 1, 0.8, 1.0, 934, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_deinit", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_deinit", "annotation": ""}, "snippet": " general.wavelet_deinit(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "label": "on_wavelet_participants_changed", "type": "function", "loc": [37, 48], "level": 0, "parent": null, "vector": [2, 0, 0.332, 0.0938, 0, 0.66, 0.7059, 785, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "on_wavelet_participants_changed", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_wavelet_participants_changed(event, wavelet):\n if preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L38_C4", "label": "if", "type": "if", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [4, 1, 0.2969, 0.0078, 1, 0.72, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L38_C49", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L38_C4", "vector": [13, 2, 0.2969, 0.0078, 2, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L39_C4", "label": "info()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [8, 1, 0.3047, 0.0078, 1, 0.72, 0.2, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L40_C4", "label": "setup_oauth()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [8, 1, 0.3125, 0.0078, 1, 0.72, 0.4, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L42_C4", "label": "if", "type": "if", "loc": [42, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [4, 1, 0.332, 0.0156, 1, 0.72, 0.6, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L43_C8", "label": "wavelet_init()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L42_C4", "vector": [8, 2, 0.3359, 0.0078, 2, 0.78, 0.0, 515, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_init", "annotation": ""}, "snippet": " general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L45_C4", "label": "message =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [14, 1, 0.3516, 0.0078, 1, 0.72, 0.8, 635, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " message = templates.ADDED_MESSAGE % event.modified_by"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:For_L46_C4", "label": "for participant", "type": "for", "loc": [46, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "vector": [6, 1, 0.3672, 0.0234, 1, 0.72, 1.0, 606, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for participant in event.participants_added:\n general.participant_wavelet_init(wavelet, participant,\n event.modified_by, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L47_C8", "label": "participant_wavelet_init()", "type": "expression", "loc": [47, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:For_L46_C4", "vector": [8, 2, 0.3711, 0.0156, 2, 0.56, 0.0, 50, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "participant_wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "participant_wavelet_init", "annotation": ""}, "snippet": " general.participant_wavelet_init(wavelet, participant,\n event.modified_by, message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "label": "on_blip_submitted", "type": "function", "loc": [55, 63], "level": 0, "parent": null, "vector": [2, 0, 0.4609, 0.0703, 0, 0.66, 0.7647, 282, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "on_blip_submitted", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_blip_submitted(event, wavelet):\n if preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L56_C4", "label": "if", "type": "if", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "vector": [4, 1, 0.4375, 0.0078, 1, 0.92, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L56_C49", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L56_C4", "vector": [13, 2, 0.4375, 0.0078, 2, 0.7, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L57_C4", "label": "info()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "vector": [8, 1, 0.4453, 0.0078, 1, 0.92, 0.25, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L58_C4", "label": "setup_oauth()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "vector": [8, 1, 0.4531, 0.0078, 1, 0.92, 0.5, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L60_C4", "label": "if", "type": "if", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "vector": [4, 1, 0.4727, 0.0156, 1, 0.92, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L61_C8", "label": "wavelet_init()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L60_C4", "vector": [8, 2, 0.4766, 0.0078, 2, 0.46, 0.0, 515, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_init", "annotation": ""}, "snippet": " general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L63_C4", "label": "notify_submitted()", "type": "expression", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "vector": [8, 1, 0.4922, 0.0078, 1, 0.92, 1.0, 798, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "notify_submitted", "arg_names": [], "import_names": [], "rhs_call_name": "notify_submitted", "annotation": ""}, "snippet": " notifications.notify_submitted(wavelet, event.blip, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "label": "on_wavelet_blip_removed", "type": "function", "loc": [66, 74], "level": 0, "parent": null, "vector": [2, 0, 0.5469, 0.0703, 0, 0.66, 0.8235, 104, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "on_wavelet_blip_removed", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_wavelet_blip_removed(event, wavelet):\n if preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L67_C4", "label": "if", "type": "if", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "vector": [4, 1, 0.5234, 0.0078, 1, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L67_C49", "label": "return", "type": "return", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L67_C4", "vector": [13, 2, 0.5234, 0.0078, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L68_C4", "label": "info()", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "vector": [8, 1, 0.5312, 0.0078, 1, 0.51, 0.25, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L69_C4", "label": "setup_oauth()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "vector": [8, 1, 0.5391, 0.0078, 1, 0.51, 0.5, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "vector": [4, 1, 0.5586, 0.0156, 1, 0.51, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if wavelet.root_blip and event.blip_id == wavelet.root_blip.blip_id:\n general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L72_C8", "label": "wavelet_init()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L71_C4", "vector": [8, 2, 0.5625, 0.0078, 2, 0.38, 0.0, 515, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_init", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_init", "annotation": ""}, "snippet": " general.wavelet_init(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L74_C4", "label": "notify_removed()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "vector": [8, 1, 0.5781, 0.0078, 1, 0.51, 1.0, 810, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "notify_removed", "arg_names": [], "import_names": [], "rhs_call_name": "notify_removed", "annotation": ""}, "snippet": " notifications.notify_removed(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "label": "on_form_button_clicked", "type": "function", "loc": [81, 86], "level": 0, "parent": null, "vector": [2, 0, 0.6523, 0.0469, 0, 0.66, 0.8824, 624, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "on_form_button_clicked", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def on_form_button_clicked(event, wavelet):\n if not preferences.is_preferences_wave(wavelet): return\n logging.info('%s called', event.type)\n setup_oauth(wavelet.robot, wavelet.domain)\n\n preferences.handle_event(event, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L82_C4", "label": "if", "type": "if", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "vector": [4, 1, 0.6406, 0.0078, 1, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L82_C53", "label": "return", "type": "return", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L82_C4", "vector": [13, 2, 0.6406, 0.0078, 2, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not preferences.is_preferences_wave(wavelet): return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L83_C4", "label": "info()", "type": "expression", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "vector": [8, 1, 0.6484, 0.0078, 1, 0.57, 0.3333, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('%s called', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L84_C4", "label": "setup_oauth()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "vector": [8, 1, 0.6562, 0.0078, 1, 0.57, 0.6667, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(wavelet.robot, wavelet.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L86_C4", "label": "handle_event()", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "vector": [8, 1, 0.6719, 0.0078, 1, 0.57, 1.0, 48, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "handle_event", "arg_names": [], "import_names": [], "rhs_call_name": "handle_event", "annotation": ""}, "snippet": " preferences.handle_event(event, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "label": "create_robot", "type": "function", "loc": [93, 118], "level": 0, "parent": null, "vector": [2, 0, 0.8242, 0.2031, 0, 0.66, 0.9412, 641, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "create_robot", "arg_names": ["run", "domain"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_robot(run=True, domain=None):\n robot = Robot(constants.ROBOT_NAME.title(), image_url=constants.ROBOT_IMG,\n profile_url=constants.ROBOT_BASE_URL)\n\n robot.register_handler(events.WaveletSelfAdded, on_wavelet_self_added, context=[ events.Context.ROOT ])\n robot.register_handler(events.WaveletSelfRemoved, on_wavelet_self_removed, context=[ events.Context.ROOT ])\n\n robot.register_handler(events.WaveletParticipantsChanged, on_wavelet_participants_changed, context=[ events.Context.ROOT ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L94_C4", "label": "robot = Robot()", "type": "assigned_variable", "loc": [94, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [14, 1, 0.7383, 0.0156, 1, 0.95, 0.0, 735, 3, 3, 0, 0, 440, 10, 2], "semantic": {"name": "robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot = Robot(constants.ROBOT_NAME.title(), image_url=constants.ROBOT_IMG,\n profile_url=constants.ROBOT_BASE_URL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L97_C4", "label": "register_handler()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.7578, 0.0078, 1, 0.95, 0.1111, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.WaveletSelfAdded, on_wavelet_self_added, context=[ events.Context.ROOT ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L98_C4", "label": "register_handler()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.7656, 0.0078, 1, 0.95, 0.2222, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.WaveletSelfRemoved, on_wavelet_self_removed, context=[ events.Context.ROOT ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L100_C4", "label": "register_handler()", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.7812, 0.0078, 1, 0.95, 0.3333, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.WaveletParticipantsChanged, on_wavelet_participants_changed, context=[ events.Context.ROOT ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L102_C4", "label": "register_handler()", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.7969, 0.0078, 1, 0.95, 0.4444, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.BlipSubmitted, on_blip_submitted, context=[ events.Context.SELF ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L103_C4", "label": "register_handler()", "type": "expression", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.8047, 0.0078, 1, 0.95, 0.5556, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.WaveletBlipRemoved, on_wavelet_blip_removed, context=[ events.Context.SELF ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L105_C4", "label": "register_handler()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [8, 1, 0.8203, 0.0078, 1, 0.95, 0.6667, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.FormButtonClicked, on_form_button_clicked, context=[ events.Context.ALL ])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L112_C4", "label": "if", "type": "if", "loc": [112, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [4, 1, 0.8789, 0.0156, 1, 0.95, 0.7778, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if domain:\n setup_oauth(robot, domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L113_C8", "label": "setup_oauth()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L112_C4", "vector": [8, 2, 0.8828, 0.0078, 2, 0.42, 0.0, 483, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " setup_oauth(robot, domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L115_C4", "label": "if", "type": "if", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [4, 1, 0.9023, 0.0156, 1, 0.95, 0.8889, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if run:\n appengine_robot_runner.run(robot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L116_C8", "label": "run()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L115_C4", "vector": [8, 2, 0.9062, 0.0078, 2, 0.26, 0.0, 679, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " appengine_robot_runner.run(robot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L118_C4", "label": "return", "type": "return", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "vector": [13, 1, 0.9219, 0.0078, 1, 0.95, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "label": "setup_oauth", "type": "function", "loc": [121, 128], "level": 0, "parent": null, "vector": [2, 0, 0.9727, 0.0625, 0, 0.66, 1.0, 483, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "setup_oauth", "arg_names": ["robot", "domain"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup_oauth(robot, domain):\n consumer_key = model.ApplicationSettings.get(\"consumer-key\")\n consumer_secret = model.ApplicationSettings.get(\"consumer-secret\")\n if domain in constants.RPC_URL:\n url = constants.RPC_URL[domain]\n else:\n url = constants.RPC_URL['googlewave.com'] # TODO\n robot.setup_oauth(consumer_key, consumer_secret, url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L122_C4", "label": "consumer_key = get()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "vector": [14, 1, 0.9531, 0.0078, 1, 0.8, 0.0, 353, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " consumer_key = model.ApplicationSettings.get(\"consumer-key\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L123_C4", "label": "consumer_secret = get()", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "vector": [14, 1, 0.9609, 0.0078, 1, 0.8, 0.3333, 734, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "consumer_secret", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " consumer_secret = model.ApplicationSettings.get(\"consumer-secret\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4", "label": "if", "type": "if", "loc": [124, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "vector": [4, 1, 0.9805, 0.0312, 1, 0.8, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if domain in constants.RPC_URL:\n url = constants.RPC_URL[domain]\n else:\n url = constants.RPC_URL['googlewave.com'] # TODO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L125_C8", "label": "url =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4", "vector": [14, 2, 0.9766, 0.0078, 2, 0.93, 0.0, 789, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = constants.RPC_URL[domain]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L127_C8", "label": "url =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4", "vector": [14, 2, 0.9922, 0.0078, 2, 0.93, 1.0, 789, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = constants.RPC_URL['googlewave.com'] # TODO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L128_C4", "label": "setup_oauth()", "type": "expression", "loc": [128, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "vector": [8, 1, 1.0, 0.0078, 1, 0.8, 1.0, 483, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setup_oauth", "arg_names": [], "import_names": [], "rhs_call_name": "setup_oauth", "annotation": ""}, "snippet": " robot.setup_oauth(consumer_key, consumer_secret, url)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L22_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L21_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L30_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L38_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L42_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:For_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:For_L46_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L56_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L61_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L67_C49"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L82_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L82_C53"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Return_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:If_L124_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Assign_L127_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1103:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1103:Expr_L128_C4"}] |
# -*- coding: UTF-8 -*-
import logging
from waveapi.element import Gadget
from notifiy import constants
from notifiy import model
from notifiy import preferences
GADGET_URL = '%s/%s.xml' % (constants.ROBOT_BASE_URL, constants.ROBOT_ID)
def is_gadget_present(wavelet):
return bool(wavelet.root_blip.first(Gadget, url=GADGET_URL))
def gadget_add(wavelet):
if not is_gadget_present(wavelet):
try:
wavelet.root_blip.at(1).insert(Gadget(GADGET_URL))
except IndexError:
logging.warn('Could not insert gadget!')
def gadget_remove(wavelet):
if is_gadget_present(wavelet):
wavelet.root_blip.all(GADGET_URL).delete()
def handle_state_change(event, wavelet):
if not wavelet.root_blip.blip_id == event.blip_id: return
if not wavelet.root_blip.all(Gadget)[event.index].url == GADGET_URL: return
pp = model.ParticipantPreferences.get_by_pk(event.modified_by)
preferences_wavelet = preferences.fetch_preferences_wavelet(wavelet, pp.preferences_wave_id, None)
eh = preferences.ExecHandler(event, preferences_wavelet)
eh.reset()
| ajibawa-2023/Python-Code-Large/train/row_1104 | 25 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0789, 0.0263, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:ImportFrom_L5_C0", "label": "from waveapi.element import Gadget", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.1316, 0.0263, 0, 0.66, 0.1111, 665, 0, 1, 0, 0, 665, 0, 0], "semantic": {"name": "waveapi.element", "arg_names": [], "import_names": ["Gadget"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi.element import Gadget"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:ImportFrom_L7_C0", "label": "from notifiy import constants", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1842, 0.0263, 0, 0.66, 0.2222, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["constants"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import constants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:ImportFrom_L8_C0", "label": "from notifiy import model", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0263, 0, 0.66, 0.3333, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:ImportFrom_L9_C0", "label": "from notifiy import preferences", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.2368, 0.0263, 0, 0.66, 0.4444, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["preferences"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import preferences"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L11_C0", "label": "GADGET_URL =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2895, 0.0263, 0, 0.66, 0.5556, 945, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "GADGET_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "GADGET_URL = '%s/%s.xml' % (constants.ROBOT_BASE_URL, constants.ROBOT_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L14_C0", "label": "is_gadget_present", "type": "function", "loc": [14, 15], "level": 0, "parent": null, "vector": [2, 0, 0.3816, 0.0526, 0, 0.66, 0.6667, 480, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_gadget_present", "arg_names": ["wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_gadget_present(wavelet):\n return bool(wavelet.root_blip.first(Gadget, url=GADGET_URL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L15_C4", "label": "return", "type": "return", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L14_C0", "vector": [13, 1, 0.3947, 0.0263, 1, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return bool(wavelet.root_blip.first(Gadget, url=GADGET_URL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L18_C0", "label": "gadget_add", "type": "function", "loc": [18, 23], "level": 0, "parent": null, "vector": [2, 0, 0.5395, 0.1579, 0, 0.66, 0.7778, 851, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "gadget_add", "arg_names": ["wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gadget_add(wavelet):\n if not is_gadget_present(wavelet):\n try:\n wavelet.root_blip.at(1).insert(Gadget(GADGET_URL))\n except IndexError:\n logging.warn('Could not insert gadget!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L19_C4", "label": "if", "type": "if", "loc": [19, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L18_C0", "vector": [4, 1, 0.5526, 0.1316, 1, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not is_gadget_present(wavelet):\n try:\n wavelet.root_blip.at(1).insert(Gadget(GADGET_URL))\n except IndexError:\n logging.warn('Could not insert gadget!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8", "label": "try", "type": "try", "loc": [20, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L19_C4", "vector": [7, 2, 0.5658, 0.1053, 2, 0.71, 0.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n wavelet.root_blip.at(1).insert(Gadget(GADGET_URL))\n except IndexError:\n logging.warn('Could not insert gadget!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L21_C12", "label": "insert()", "type": "expression", "loc": [21, 21], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8", "vector": [8, 3, 0.5526, 0.0263, 3, 0.94, 0.0, 368, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " wavelet.root_blip.at(1).insert(Gadget(GADGET_URL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L23_C12", "label": "warn()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8", "vector": [8, 3, 0.6053, 0.0263, 3, 0.94, 0.0, 960, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn('Could not insert gadget!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L26_C0", "label": "gadget_remove", "type": "function", "loc": [26, 28], "level": 0, "parent": null, "vector": [2, 0, 0.7105, 0.0789, 0, 0.66, 0.8889, 259, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "gadget_remove", "arg_names": ["wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def gadget_remove(wavelet):\n if is_gadget_present(wavelet):\n wavelet.root_blip.all(GADGET_URL).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L27_C4", "label": "if", "type": "if", "loc": [27, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L26_C0", "vector": [4, 1, 0.7237, 0.0526, 1, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_gadget_present(wavelet):\n wavelet.root_blip.all(GADGET_URL).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L28_C8", "label": "delete()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L27_C4", "vector": [8, 2, 0.7368, 0.0263, 2, 0.93, 0.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " wavelet.root_blip.all(GADGET_URL).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "label": "handle_state_change", "type": "function", "loc": [31, 38], "level": 0, "parent": null, "vector": [2, 0, 0.9079, 0.2105, 0, 0.66, 1.0, 323, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "handle_state_change", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def handle_state_change(event, wavelet):\n if not wavelet.root_blip.blip_id == event.blip_id: return\n if not wavelet.root_blip.all(Gadget)[event.index].url == GADGET_URL: return\n\n pp = model.ParticipantPreferences.get_by_pk(event.modified_by)\n preferences_wavelet = preferences.fetch_preferences_wavelet(wavelet, pp.preferences_wave_id, None)\n eh = preferences.ExecHandler(event, preferences_wavelet)\n eh.reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L32_C4", "label": "if", "type": "if", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [4, 1, 0.8421, 0.0263, 1, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet.root_blip.blip_id == event.blip_id: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L32_C55", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L32_C4", "vector": [13, 2, 0.8421, 0.0263, 2, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet.root_blip.blip_id == event.blip_id: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L33_C4", "label": "if", "type": "if", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [4, 1, 0.8684, 0.0263, 1, 0.95, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet.root_blip.all(Gadget)[event.index].url == GADGET_URL: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L33_C73", "label": "return", "type": "return", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L33_C4", "vector": [13, 2, 0.8684, 0.0263, 2, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet.root_blip.all(Gadget)[event.index].url == GADGET_URL: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L35_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [14, 1, 0.9211, 0.0263, 1, 0.95, 0.4, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L36_C4", "label": "preferences_wavelet = fetch_preferences_wavelet()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [14, 1, 0.9474, 0.0263, 1, 0.95, 0.6, 686, 3, 3, 0, 0, 538, 10, 1], "semantic": {"name": "preferences_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_preferences_wavelet", "annotation": ""}, "snippet": " preferences_wavelet = preferences.fetch_preferences_wavelet(wavelet, pp.preferences_wave_id, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L37_C4", "label": "eh = ExecHandler()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [14, 1, 0.9737, 0.0263, 1, 0.95, 0.8, 879, 3, 2, 0, 0, 201, 10, 1], "semantic": {"name": "eh", "arg_names": [], "import_names": [], "rhs_call_name": "ExecHandler", "annotation": ""}, "snippet": " eh = preferences.ExecHandler(event, preferences_wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L38_C4", "label": "reset()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "vector": [8, 1, 1.0, 0.0263, 1, 0.95, 1.0, 944, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reset", "arg_names": [], "import_names": [], "rhs_call_name": "reset", "annotation": ""}, "snippet": " eh.reset()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L21_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:Try_L20_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L23_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L27_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L32_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L32_C55"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:If_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Return_L33_C73"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1104:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1104:Expr_L38_C4"}] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import random
from google.appengine.ext import db
# TODO from google.appengine.api import memcache
from migrationmodel import MigratingModel, get_by_pk
NOTIFY_NONE = 0
NOTIFY_ONCE = 1
NOTIFY_ALL = 2
NOTIFY_TYPE_COUNT = 3
class Phone(MigratingModel):
migration_version = 1
phone_type = db.StringProperty(required=True)
phone_uid = db.StringProperty(required=True)
phone_token = db.StringProperty()
account_id = db.StringProperty()
pk = ['phone_type', 'phone_uid']
class Account(MigratingModel):
migration_version = 1
account_id = db.StringProperty(required=True)
to_date = db.DateTimeProperty(default=None)
subscription_type = db.StringProperty()
expiration_date = db.DateProperty()
transaction_id = db.StringProperty()
receipt_data = db.TextProperty()
pk = ['account_id', 'to_date']
class ParticipantPreferences(MigratingModel):
migration_version = 3
participant = db.StringProperty(required=True)
notify = db.BooleanProperty(default=True)
notify_initial = db.BooleanProperty(default=True)
email = db.StringProperty()
activation = db.StringProperty()
preferences_wave_id = db.StringProperty()
account_id = db.StringProperty()
pk = ['participant']
preferencesWaveId = db.StringProperty(default=None) # Deprecated use preferences_wave_id
def __init__(self, *args, **kwds):
self.activation = random_activation()
super(ParticipantPreferences, self).__init__(*args, **kwds)
def put(self, *args, **kwds):
# TODO memcache.set(self.get_key(), self, namespace='pp')
super(ParticipantPreferences, self).put(*args, **kwds)
def migrate_1(self):
if self.notify_initial == None:
self.notify_initial = True
def migrate_2(self):
if self.activation == None:
self.activation = random_activation()
def migrate_3(self):
if self.preferencesWaveId:
self.preferences_wave_id = self.preferencesWaveId;
class ParticipantWavePreferences(MigratingModel):
migration_version = 2
participant = db.StringProperty(required=True)
wave_id = db.StringProperty(required=False) # TODO migrate all entities
notify_type = db.IntegerProperty(default=NOTIFY_NONE)
visited = db.BooleanProperty(default=False)
last_visited = db.DateTimeProperty()
pk = ['participant', 'wave_id']
waveId = db.StringProperty(default=None) # Deprecated use wave_id
notify = db.BooleanProperty(default=None) # Deprecated use notify_type
#def put(self, *args, **kwds):
# TODO
# memcache.set(self.get_key(), self, namespace='pwp')
# super(ParticipantWavePreferences, self).put(*args, **kwds)
def migrate_1(self):
if self.notify != None:
if self.notify:
self.notify_type = NOTIFY_ALL
self.notify = None
def migrate_2(self):
if self.waveId:
self.wave_id = self.waveId;
@classmethod
def get_by_pk(cls, *args, **kw):
o = get_by_pk(cls, *args, **kw)
if not o:
q = ParticipantWavePreferences.all()
q.filter('participant =', args[0])
q.filter('waveId =', args[1])
o = q.get()
return o
class ApplicationSettings(MigratingModel):
migration_version = 0
keyname = db.StringProperty(required=True)
value = db.StringProperty()
pk = ['keyname']
@classmethod
def get(cls, keyname):
return cls.get_by_pk(keyname).value
def random_activation():
return ''.join([str(random.randint(0, 9)) for a in range(9)])
| ajibawa-2023/Python-Code-Large/train/row_1106 | 83 | 132 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Import_L4_C0", "label": "random import random", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0303, 0.0076, 0, 0.66, 0.0, 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_1106:ImportFrom_L6_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0076, 0, 0.66, 0.0833, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ImportFrom_L9_C0", "label": "from migrationmodel import MigratingModel, get_by_pk", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0682, 0.0076, 0, 0.66, 0.1667, 879, 0, 2, 0, 0, 879, 0, 0], "semantic": {"name": "migrationmodel", "arg_names": [], "import_names": ["MigratingModel", "get_by_pk"], "rhs_call_name": "", "annotation": ""}, "snippet": "from migrationmodel import MigratingModel, get_by_pk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L11_C0", "label": "NOTIFY_NONE =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0833, 0.0076, 0, 0.66, 0.25, 201, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NOTIFY_NONE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOTIFY_NONE = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L12_C0", "label": "NOTIFY_ONCE =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0909, 0.0076, 0, 0.66, 0.3333, 527, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NOTIFY_ONCE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOTIFY_ONCE = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L13_C0", "label": "NOTIFY_ALL =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0985, 0.0076, 0, 0.66, 0.4167, 598, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NOTIFY_ALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOTIFY_ALL = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L15_C0", "label": "NOTIFY_TYPE_COUNT =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1136, 0.0076, 0, 0.66, 0.5, 167, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "NOTIFY_TYPE_COUNT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOTIFY_TYPE_COUNT = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "label": "Phone", "type": "class", "loc": [18, 26], "level": 0, "parent": null, "vector": [3, 0, 0.1667, 0.0682, 0, 0.66, 0.5833, 223, 0, 0, 0, 0, 176, 0, 4], "semantic": {"name": "Phone", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Phone(MigratingModel):\n migration_version = 1\n\n phone_type = db.StringProperty(required=True)\n phone_uid = db.StringProperty(required=True)\n phone_token = db.StringProperty()\n account_id = db.StringProperty()\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L19_C4", "label": "migration_version =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.1439, 0.0076, 1, 0.32, 0.0, 950, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "migration_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " migration_version = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L21_C4", "label": "phone_type = StringProperty()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.1591, 0.0076, 1, 0.32, 0.2, 986, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "phone_type", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " phone_type = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L22_C4", "label": "phone_uid = StringProperty()", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.1667, 0.0076, 1, 0.32, 0.4, 856, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "phone_uid", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " phone_uid = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L23_C4", "label": "phone_token = StringProperty()", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.1742, 0.0076, 1, 0.32, 0.6, 197, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "phone_token", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " phone_token = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L24_C4", "label": "account_id = StringProperty()", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.1818, 0.0076, 1, 0.32, 0.8, 79, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "account_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " account_id = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L26_C4", "label": "pk =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "vector": [14, 1, 0.197, 0.0076, 1, 0.32, 1.0, 164, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pk = ['phone_type', 'phone_uid']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "label": "Account", "type": "class", "loc": [29, 39], "level": 0, "parent": null, "vector": [3, 0, 0.2576, 0.0833, 0, 0.66, 0.6667, 399, 0, 0, 0, 0, 176, 0, 6], "semantic": {"name": "Account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Account(MigratingModel):\n migration_version = 1\n\n account_id = db.StringProperty(required=True)\n to_date = db.DateTimeProperty(default=None)\n subscription_type = db.StringProperty()\n expiration_date = db.DateProperty()\n transaction_id = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L30_C4", "label": "migration_version =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2273, 0.0076, 1, 0.49, 0.0, 950, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "migration_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " migration_version = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L32_C4", "label": "account_id = StringProperty()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2424, 0.0076, 1, 0.49, 0.1429, 79, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "account_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " account_id = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L33_C4", "label": "to_date = DateTimeProperty()", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.25, 0.0076, 1, 0.49, 0.2857, 969, 3, 1, 0, 0, 721, 10, 1], "semantic": {"name": "to_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " to_date = db.DateTimeProperty(default=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L34_C4", "label": "subscription_type = StringProperty()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2576, 0.0076, 1, 0.49, 0.4286, 465, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "subscription_type", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " subscription_type = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L35_C4", "label": "expiration_date = DateProperty()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2652, 0.0076, 1, 0.49, 0.5714, 950, 3, 0, 0, 0, 838, 10, 1], "semantic": {"name": "expiration_date", "arg_names": [], "import_names": [], "rhs_call_name": "DateProperty", "annotation": ""}, "snippet": " expiration_date = db.DateProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L36_C4", "label": "transaction_id = StringProperty()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2727, 0.0076, 1, 0.49, 0.7143, 797, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "transaction_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " transaction_id = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L37_C4", "label": "receipt_data = TextProperty()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2803, 0.0076, 1, 0.49, 0.8571, 470, 3, 0, 0, 0, 331, 10, 1], "semantic": {"name": "receipt_data", "arg_names": [], "import_names": [], "rhs_call_name": "TextProperty", "annotation": ""}, "snippet": " receipt_data = db.TextProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L39_C4", "label": "pk =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "vector": [14, 1, 0.2955, 0.0076, 1, 0.49, 1.0, 164, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pk = ['account_id', 'to_date']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "label": "ParticipantPreferences", "type": "class", "loc": [42, 75], "level": 0, "parent": null, "vector": [3, 0, 0.4432, 0.2576, 0, 0.66, 0.75, 112, 0, 5, 0, 0, 176, 0, 14], "semantic": {"name": "ParticipantPreferences", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ParticipantPreferences(MigratingModel):\n migration_version = 3\n\n participant = db.StringProperty(required=True)\n notify = db.BooleanProperty(default=True)\n notify_initial = db.BooleanProperty(default=True)\n email = db.StringProperty()\n activation = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L43_C4", "label": "migration_version =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3258, 0.0076, 1, 0.69, 0.0, 950, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "migration_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " migration_version = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L45_C4", "label": "participant = StringProperty()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3409, 0.0076, 1, 0.69, 0.0714, 606, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " participant = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L46_C4", "label": "notify = BooleanProperty()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3485, 0.0076, 1, 0.69, 0.1429, 133, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "notify", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanProperty", "annotation": ""}, "snippet": " notify = db.BooleanProperty(default=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L47_C4", "label": "notify_initial = BooleanProperty()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3561, 0.0076, 1, 0.69, 0.2143, 821, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "notify_initial", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanProperty", "annotation": ""}, "snippet": " notify_initial = db.BooleanProperty(default=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L48_C4", "label": "email = StringProperty()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3636, 0.0076, 1, 0.69, 0.2857, 413, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " email = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L49_C4", "label": "activation = StringProperty()", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3712, 0.0076, 1, 0.69, 0.3571, 102, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "activation", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " activation = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L50_C4", "label": "preferences_wave_id = StringProperty()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3788, 0.0076, 1, 0.69, 0.4286, 890, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "preferences_wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " preferences_wave_id = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L51_C4", "label": "account_id = StringProperty()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.3864, 0.0076, 1, 0.69, 0.5, 79, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "account_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " account_id = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L53_C4", "label": "pk =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.4015, 0.0076, 1, 0.69, 0.5714, 164, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pk = ['participant']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L55_C4", "label": "preferencesWaveId = StringProperty()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [14, 1, 0.4167, 0.0076, 1, 0.69, 0.6429, 314, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "preferencesWaveId", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " preferencesWaveId = db.StringProperty(default=None) # Deprecated use preferences_wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4", "label": "__init__", "type": "function", "loc": [57, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [2, 1, 0.4394, 0.0227, 1, 0.69, 0.7143, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwds):\n self.activation = random_activation()\n super(ParticipantPreferences, self).__init__(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L58_C8", "label": "self.activation = random_activation()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4", "vector": [14, 2, 0.4394, 0.0076, 2, 0.96, 0.0, 337, 3, 0, 0, 0, 439, 10, 1], "semantic": {"name": "self.activation", "arg_names": [], "import_names": [], "rhs_call_name": "random_activation", "annotation": ""}, "snippet": " self.activation = random_activation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L59_C8", "label": "__init__()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4", "vector": [8, 2, 0.447, 0.0076, 2, 0.96, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(ParticipantPreferences, self).__init__(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L61_C4", "label": "put", "type": "function", "loc": [61, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [2, 1, 0.4697, 0.0227, 1, 0.69, 0.7857, 636, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "put", "arg_names": ["self", "args", "kwds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def put(self, *args, **kwds):\n # TODO memcache.set(self.get_key(), self, namespace='pp')\n super(ParticipantPreferences, self).put(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L63_C8", "label": "put()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L61_C4", "vector": [8, 2, 0.4773, 0.0076, 2, 0.47, 0.0, 636, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " super(ParticipantPreferences, self).put(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L65_C4", "label": "migrate_1", "type": "function", "loc": [65, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [2, 1, 0.5, 0.0227, 1, 0.69, 0.8571, 960, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "migrate_1", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def migrate_1(self):\n if self.notify_initial == None:\n self.notify_initial = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L66_C8", "label": "if", "type": "if", "loc": [66, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L65_C4", "vector": [4, 2, 0.5038, 0.0152, 2, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.notify_initial == None:\n self.notify_initial = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L67_C12", "label": "self.notify_initial =", "type": "assigned_variable", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L66_C8", "vector": [14, 3, 0.5076, 0.0076, 3, 0.6, 0.0, 862, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.notify_initial", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.notify_initial = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L69_C4", "label": "migrate_2", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [2, 1, 0.5303, 0.0227, 1, 0.69, 0.9286, 926, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "migrate_2", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def migrate_2(self):\n if self.activation == None:\n self.activation = random_activation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L70_C8", "label": "if", "type": "if", "loc": [70, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L69_C4", "vector": [4, 2, 0.5341, 0.0152, 2, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.activation == None:\n self.activation = random_activation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L71_C12", "label": "self.activation = random_activation()", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L70_C8", "vector": [14, 3, 0.5379, 0.0076, 3, 0.39, 0.0, 337, 3, 0, 0, 0, 439, 10, 1], "semantic": {"name": "self.activation", "arg_names": [], "import_names": [], "rhs_call_name": "random_activation", "annotation": ""}, "snippet": " self.activation = random_activation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L73_C4", "label": "migrate_3", "type": "function", "loc": [73, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "vector": [2, 1, 0.5606, 0.0227, 1, 0.69, 1.0, 490, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "migrate_3", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def migrate_3(self):\n if self.preferencesWaveId:\n self.preferences_wave_id = self.preferencesWaveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L74_C8", "label": "if", "type": "if", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L73_C4", "vector": [4, 2, 0.5644, 0.0152, 2, 0.91, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.preferencesWaveId:\n self.preferences_wave_id = self.preferencesWaveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L75_C12", "label": "self.preferences_wave_id =", "type": "assigned_variable", "loc": [75, 75], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L74_C8", "vector": [14, 3, 0.5682, 0.0076, 3, 0.03, 0.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.preferences_wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.preferences_wave_id = self.preferencesWaveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "label": "ParticipantWavePreferences", "type": "class", "loc": [78, 115], "level": 0, "parent": null, "vector": [3, 0, 0.7311, 0.2879, 0, 0.66, 0.8333, 306, 0, 3, 0, 0, 176, 0, 12], "semantic": {"name": "ParticipantWavePreferences", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ParticipantWavePreferences(MigratingModel):\n migration_version = 2\n\n participant = db.StringProperty(required=True)\n wave_id = db.StringProperty(required=False) # TODO migrate all entities\n notify_type = db.IntegerProperty(default=NOTIFY_NONE)\n visited = db.BooleanProperty(default=False)\n last_visited = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L79_C4", "label": "migration_version =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.5985, 0.0076, 1, 0.17, 0.0, 950, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "migration_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " migration_version = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L81_C4", "label": "participant = StringProperty()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6136, 0.0076, 1, 0.17, 0.0909, 606, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " participant = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L82_C4", "label": "wave_id = StringProperty()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6212, 0.0076, 1, 0.17, 0.1818, 347, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " wave_id = db.StringProperty(required=False) # TODO migrate all entities"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L83_C4", "label": "notify_type = IntegerProperty()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6288, 0.0076, 1, 0.17, 0.2727, 305, 3, 1, 0, 0, 703, 10, 1], "semantic": {"name": "notify_type", "arg_names": [], "import_names": [], "rhs_call_name": "IntegerProperty", "annotation": ""}, "snippet": " notify_type = db.IntegerProperty(default=NOTIFY_NONE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L84_C4", "label": "visited = BooleanProperty()", "type": "assigned_variable", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6364, 0.0076, 1, 0.17, 0.3636, 574, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "visited", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanProperty", "annotation": ""}, "snippet": " visited = db.BooleanProperty(default=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L85_C4", "label": "last_visited = DateTimeProperty()", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6439, 0.0076, 1, 0.17, 0.4545, 227, 3, 0, 0, 0, 721, 10, 1], "semantic": {"name": "last_visited", "arg_names": [], "import_names": [], "rhs_call_name": "DateTimeProperty", "annotation": ""}, "snippet": " last_visited = db.DateTimeProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L87_C4", "label": "pk =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6591, 0.0076, 1, 0.17, 0.5455, 164, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pk = ['participant', 'wave_id']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L89_C4", "label": "waveId = StringProperty()", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6742, 0.0076, 1, 0.17, 0.6364, 324, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "waveId", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " waveId = db.StringProperty(default=None) # Deprecated use wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L90_C4", "label": "notify = BooleanProperty()", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [14, 1, 0.6818, 0.0076, 1, 0.17, 0.7273, 133, 3, 1, 0, 0, 863, 10, 1], "semantic": {"name": "notify", "arg_names": [], "import_names": [], "rhs_call_name": "BooleanProperty", "annotation": ""}, "snippet": " notify = db.BooleanProperty(default=None) # Deprecated use notify_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L97_C4", "label": "migrate_1", "type": "function", "loc": [97, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [2, 1, 0.75, 0.0379, 1, 0.17, 0.8182, 960, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "migrate_1", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def migrate_1(self):\n if self.notify != None:\n if self.notify:\n self.notify_type = NOTIFY_ALL\n self.notify = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8", "label": "if", "type": "if", "loc": [98, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L97_C4", "vector": [4, 2, 0.7538, 0.0303, 2, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.notify != None:\n if self.notify:\n self.notify_type = NOTIFY_ALL\n self.notify = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L99_C12", "label": "if", "type": "if", "loc": [99, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8", "vector": [4, 3, 0.7538, 0.0152, 3, 0.56, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.notify:\n self.notify_type = NOTIFY_ALL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L100_C16", "label": "self.notify_type =", "type": "assigned_variable", "loc": [100, 100], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L99_C12", "vector": [14, 4, 0.7576, 0.0076, 4, 0.34, 0.0, 558, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.notify_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.notify_type = NOTIFY_ALL"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L101_C12", "label": "self.notify =", "type": "assigned_variable", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8", "vector": [14, 3, 0.7652, 0.0076, 3, 0.56, 1.0, 722, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self.notify", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.notify = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L103_C4", "label": "migrate_2", "type": "function", "loc": [103, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [2, 1, 0.7879, 0.0227, 1, 0.17, 0.9091, 926, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "migrate_2", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def migrate_2(self):\n if self.waveId:\n self.wave_id = self.waveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L104_C8", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L103_C4", "vector": [4, 2, 0.7917, 0.0152, 2, 0.1, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.waveId:\n self.wave_id = self.waveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L105_C12", "label": "self.wave_id =", "type": "assigned_variable", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L104_C8", "vector": [14, 3, 0.7955, 0.0076, 3, 0.29, 0.0, 647, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wave_id = self.waveId;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "label": "get_by_pk", "type": "function", "loc": [108, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "vector": [2, 1, 0.8447, 0.0606, 1, 0.17, 1.0, 243, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "get_by_pk", "arg_names": ["cls", "args", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_by_pk(cls, *args, **kw):\n o = get_by_pk(cls, *args, **kw)\n if not o:\n q = ParticipantWavePreferences.all()\n q.filter('participant =', args[0])\n q.filter('waveId =', args[1])\n o = q.get()\n return o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L109_C8", "label": "o = get_by_pk()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "vector": [14, 2, 0.8258, 0.0076, 2, 0.02, 0.0, 926, 3, 3, 0, 0, 243, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " o = get_by_pk(cls, *args, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "label": "if", "type": "if", "loc": [110, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "vector": [4, 2, 0.8485, 0.0379, 2, 0.02, 0.5, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not o:\n q = ParticipantWavePreferences.all()\n q.filter('participant =', args[0])\n q.filter('waveId =', args[1])\n o = q.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L111_C12", "label": "q = all()", "type": "assigned_variable", "loc": [111, 111], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "vector": [14, 3, 0.8409, 0.0076, 3, 0.03, 0.0, 516, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " q = ParticipantWavePreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L112_C12", "label": "filter()", "type": "expression", "loc": [112, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "vector": [8, 3, 0.8485, 0.0076, 3, 0.03, 0.3333, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q.filter('participant =', args[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L113_C12", "label": "filter()", "type": "expression", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "vector": [8, 3, 0.8561, 0.0076, 3, 0.03, 0.6667, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " q.filter('waveId =', args[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L114_C12", "label": "o = get()", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "vector": [14, 3, 0.8636, 0.0076, 3, 0.03, 1.0, 926, 3, 0, 0, 0, 607, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " o = q.get()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L115_C8", "label": "return", "type": "return", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "vector": [13, 2, 0.8712, 0.0076, 2, 0.02, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "label": "ApplicationSettings", "type": "class", "loc": [118, 128], "level": 0, "parent": null, "vector": [3, 0, 0.9318, 0.0833, 0, 0.66, 0.9167, 296, 0, 1, 0, 0, 176, 0, 3], "semantic": {"name": "ApplicationSettings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ApplicationSettings(MigratingModel):\n migration_version = 0\n\n keyname = db.StringProperty(required=True)\n value = db.StringProperty()\n\n pk = ['keyname']\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L119_C4", "label": "migration_version =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "vector": [14, 1, 0.9015, 0.0076, 1, 0.55, 0.0, 950, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "migration_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " migration_version = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L121_C4", "label": "keyname = StringProperty()", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "vector": [14, 1, 0.9167, 0.0076, 1, 0.55, 0.25, 986, 3, 1, 0, 0, 882, 10, 1], "semantic": {"name": "keyname", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " keyname = db.StringProperty(required=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L122_C4", "label": "value = StringProperty()", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "vector": [14, 1, 0.9242, 0.0076, 1, 0.55, 0.5, 441, 3, 0, 0, 0, 882, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "StringProperty", "annotation": ""}, "snippet": " value = db.StringProperty()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L124_C4", "label": "pk =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "vector": [14, 1, 0.9394, 0.0076, 1, 0.55, 0.75, 164, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pk = ['keyname']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L127_C4", "label": "get", "type": "function", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "vector": [2, 1, 0.9659, 0.0152, 1, 0.55, 1.0, 607, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["cls", "keyname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(cls, keyname):\n return cls.get_by_pk(keyname).value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L128_C8", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L127_C4", "vector": [13, 2, 0.9697, 0.0076, 2, 0.68, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls.get_by_pk(keyname).value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L131_C0", "label": "random_activation", "type": "function", "loc": [131, 132], "level": 0, "parent": null, "vector": [2, 0, 0.9962, 0.0152, 0, 0.66, 1.0, 439, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "random_activation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def random_activation():\n return ''.join([str(random.randint(0, 9)) for a in range(9)])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L132_C4", "label": "return", "type": "return", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L131_C0", "vector": [13, 1, 1.0, 0.0076, 1, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join([str(random.randint(0, 9)) for a in range(9)])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L66_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L67_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L70_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L74_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L74_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L75_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L99_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L100_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L101_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L111_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L112_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Expr_L113_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:If_L110_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L108_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:ClassDef_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1106:FunctionDef_L131_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1106:Return_L132_C4"}] |
# -*- coding: UTF-8 -*-
import logging
from waveapi import element
from notifiy import constants
from notifiy import model
from notifiy import templates
PARTICIPANT_DATA_DOC = '%s/participant' % constants.ROBOT_ADDRESS
VERSION_DATA_DOC = '%s/preferencesVersion' % constants.ROBOT_ADDRESS
PREFERENCES_VERSION = '14'
SETTIE_ROBOT = 'settie@a.gwave.com'
def is_preferences_wave(wavelet):
return VERSION_DATA_DOC in wavelet.data_documents
def find_participant(wavelet, participant=None):
if PARTICIPANT_DATA_DOC in wavelet.data_documents:
return wavelet.data_documents[PARTICIPANT_DATA_DOC]
else:
return participant
def fetch_preferences_wavelet(wavelet, preferences_wave_id):
prefs_wavelet = wavelet.robot.fetch_wavelet(preferences_wave_id)
return prefs_wavelet
def create_preferences_wave(robot, participant):
domain = participant.split('@')[1]
participants = [ constants.ROBOT_ADDRESS, SETTIE_ROBOT, participant ]
prefs_wavelet = robot.new_wave(domain, participants, submit=True)
update_preferences_wavelet(prefs_wavelet, participant, force=True)
robot.submit(prefs_wavelet)
def update_preferences_wavelet(wavelet, participant=None, force=False):
if not force and wavelet.data_documents[VERSION_DATA_DOC] == PREFERENCES_VERSION: return
participant = find_participant(wavelet, participant)
pp = model.ParticipantPreferences.get_by_pk(participant)
logging.debug('Updating preferences wave content for %s', participant)
if force:
pp.preferences_wave_id = wavelet.wave_id
pp.put()
content = []
content += [ element.Image(url=constants.ROBOT_LOGO, width=200, height=100, caption=constants.ROBOT_NAME.title()) ]
content.append('\n')
content += [ element.Check('notify', pp.notify), ' Notify me to this email:\n', element.Input('email', str(pp.email)), '\n' ]
content += [ element.Check('notify_initial', pp.notify_initial), ' Send initial notifications', '\n' ]
content.append('\n')
content += [ 'Phone activation code: %s\n' % pp.activation ]
if pp.account_id:
content += [ 'Phone account id: %s\n' % pp.account_id ]
query = model.Phone.all()
query.filter('account_id =', pp.account_id)
content += [ 'Phones associated with this account: %s\n' % len(list(query)) ]
query = model.ParticipantPreferences.all()
query.filter('account_id =', pp.account_id)
content += [ 'Google wave accounts associated: ' ]
content += [ ','.join([ '%s' % pp2.participant for pp2 in query ]) ]
content.append('\n')
content.append('\n')
content += [ element.Button('save_pp', 'Save'), ' ', element.Button('refresh_pp', 'Refresh'), '\n' ]
content.append('\n')
content += [ 'Execute global commands: (try "help")', element.Input('command', ''), element.Button('exec_pp', 'Exec') ]
wavelet.root_blip.all().delete()
wavelet.data_documents[PARTICIPANT_DATA_DOC] = participant
wavelet.data_documents[VERSION_DATA_DOC] = PREFERENCES_VERSION
wavelet.title = 'Notifiy global preferences'
for c in content:
wavelet.root_blip.append(c)
def delete_preferences_wavelet(wavelet, participant=None):
if not wavelet: return
if not participant:
participant = find_participant(wavelet)
pp = model.ParticipantPreferences.get_by_pk(participant)
if not pp: return
prefs_wavelet = fetch_preferences_wavelet(wavelet, pp.preferences_wave_id)
prefs_wavelet.title = "Please delete this wave"
del prefs_wavelet.data_documents[PARTICIPANT_DATA_DOC]
del prefs_wavelet.data_documents[VERSION_DATA_DOC]
prefs_wavelet.root_blip.all().delete()
wavelet.robot.submit(prefs_wavelet)
def handle_event(event, wavelet):
participant = find_participant(wavelet, event.modified_by)
logging.debug('Preferences if %s == %s' % (participant, event.modified_by))
if participant != event.modified_by: return
if event.button_name == 'save_pp':
pp = model.ParticipantPreferences.get_by_pk(participant)
for t, f, p in [ (element.Check, bool, 'notify'),
(element.Input, str, 'email'),
(element.Check, bool, 'notify_initial') ]:
form_element = wavelet.root_blip.first(t, name=p).value()
pp.__setattr__(p, f(form_element.value))
wavelet.reply(templates.PREFERENCES_SAVED)
elif event.button_name == 'refresh_pp':
if ExecHandler(event, wavelet).refresh():
wavelet.reply(templates.COMMAND_SUCCESSFUL % 'refresh')
else:
wavelet.reply(templates.ERROR_TRY_AGAIN)
elif event.button_name == 'exec_pp':
eh = ExecHandler(event, wavelet)
form_element = wavelet.root_blip.first(element.Input, name='command').value()
command = form_element.value.split(' ')
if hasattr(eh, command[0]):
result = getattr(eh, command[0])(*command[1:])
if result == True:
wavelet.reply(templates.COMMAND_SUCCESSFUL % form_element.value)
elif result == False:
wavelet.reply(templates.ERROR_TRY_AGAIN)
elif result:
wavelet.reply(result)
else:
wavelet.reply(templates.COMMAND_UNKNOWN % command)
class ExecHandler(object):
def __init__(self, event, wavelet):
self.event = event
self.wavelet = wavelet
def help(self):
logging.debug('ExecHandler help')
return templates.COMMANDS_HELP
def refresh(self):
logging.debug('ExecHandler refresh')
update_preferences_wavelet(self.wavelet, self.event.modified_by, force=True)
return True
def clean(self):
logging.debug('ExecHandler clean')
delete = []
for blip_id in self.wavelet.blips:
if blip_id != self.wavelet.root_blip.blip_id:
delete.append(blip_id)
for blip_id in delete:
self.wavelet.delete(blip_id)
def reset(self):
logging.debug('ExecHandler reset')
return "Not implemented yet"
def regen(self, participant=None):
pp = model.ParticipantPreferences.get_by_pk(participant or self.event.modified_by)
pp.activation = model.random_activation()
pp.put()
return self.refresh()
def recreate(self, participant=None):
logging.debug('ExecHandler recreate')
delete_preferences_wavelet(self.wavelet, participant or self.event.modified_by)
create_preferences_wave(self.wavelet.robot, participant or self.event.modified_by)
return True
| ajibawa-2023/Python-Code-Large/train/row_1107 | 122 | 182 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0165, 0.0055, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:ImportFrom_L5_C0", "label": "from waveapi import element", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0275, 0.0055, 0, 0.66, 0.0625, 326, 0, 1, 0, 0, 326, 0, 0], "semantic": {"name": "waveapi", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "from waveapi import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:ImportFrom_L7_C0", "label": "from notifiy import constants", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0055, 0, 0.66, 0.125, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["constants"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import constants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:ImportFrom_L8_C0", "label": "from notifiy import model", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.044, 0.0055, 0, 0.66, 0.1875, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["model"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import model"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:ImportFrom_L9_C0", "label": "from notifiy import templates", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0495, 0.0055, 0, 0.66, 0.25, 36, 0, 1, 0, 0, 36, 0, 0], "semantic": {"name": "notifiy", "arg_names": [], "import_names": ["templates"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy import templates"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L11_C0", "label": "PARTICIPANT_DATA_DOC =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.0604, 0.0055, 0, 0.66, 0.3125, 681, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "PARTICIPANT_DATA_DOC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PARTICIPANT_DATA_DOC = '%s/participant' % constants.ROBOT_ADDRESS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L12_C0", "label": "VERSION_DATA_DOC =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.0659, 0.0055, 0, 0.66, 0.375, 250, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "VERSION_DATA_DOC", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION_DATA_DOC = '%s/preferencesVersion' % constants.ROBOT_ADDRESS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L13_C0", "label": "PREFERENCES_VERSION =", "type": "assigned_variable", "loc": [13, 13], "level": 0, "parent": null, "vector": [14, 0, 0.0714, 0.0055, 0, 0.66, 0.4375, 20, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PREFERENCES_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PREFERENCES_VERSION = '14'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L15_C0", "label": "SETTIE_ROBOT =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.0824, 0.0055, 0, 0.66, 0.5, 142, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SETTIE_ROBOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SETTIE_ROBOT = 'settie@a.gwave.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L18_C0", "label": "is_preferences_wave", "type": "function", "loc": [18, 19], "level": 0, "parent": null, "vector": [2, 0, 0.1016, 0.011, 0, 0.66, 0.5625, 829, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_preferences_wave", "arg_names": ["wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_preferences_wave(wavelet):\n return VERSION_DATA_DOC in wavelet.data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L19_C4", "label": "return", "type": "return", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L18_C0", "vector": [13, 1, 0.1044, 0.0055, 1, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return VERSION_DATA_DOC in wavelet.data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L22_C0", "label": "find_participant", "type": "function", "loc": [22, 26], "level": 0, "parent": null, "vector": [2, 0, 0.1319, 0.0275, 0, 0.66, 0.625, 14, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "find_participant", "arg_names": ["wavelet", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_participant(wavelet, participant=None):\n if PARTICIPANT_DATA_DOC in wavelet.data_documents:\n return wavelet.data_documents[PARTICIPANT_DATA_DOC]\n else:\n return participant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4", "label": "if", "type": "if", "loc": [23, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L22_C0", "vector": [4, 1, 0.1346, 0.022, 1, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if PARTICIPANT_DATA_DOC in wavelet.data_documents:\n return wavelet.data_documents[PARTICIPANT_DATA_DOC]\n else:\n return participant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L24_C8", "label": "return", "type": "return", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4", "vector": [13, 2, 0.1319, 0.0055, 2, 0.81, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wavelet.data_documents[PARTICIPANT_DATA_DOC]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L26_C8", "label": "return", "type": "return", "loc": [26, 26], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4", "vector": [13, 2, 0.1429, 0.0055, 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 participant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L29_C0", "label": "fetch_preferences_wavelet", "type": "function", "loc": [29, 31], "level": 0, "parent": null, "vector": [2, 0, 0.1648, 0.0165, 0, 0.66, 0.6875, 538, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "fetch_preferences_wavelet", "arg_names": ["wavelet", "preferences_wave_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fetch_preferences_wavelet(wavelet, preferences_wave_id):\n prefs_wavelet = wavelet.robot.fetch_wavelet(preferences_wave_id)\n return prefs_wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L30_C4", "label": "prefs_wavelet = fetch_wavelet()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L29_C0", "vector": [14, 1, 0.1648, 0.0055, 1, 0.24, 0.0, 641, 3, 1, 0, 0, 327, 10, 1], "semantic": {"name": "prefs_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_wavelet", "annotation": ""}, "snippet": " prefs_wavelet = wavelet.robot.fetch_wavelet(preferences_wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L31_C4", "label": "return", "type": "return", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L29_C0", "vector": [13, 1, 0.1703, 0.0055, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return prefs_wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "label": "create_preferences_wave", "type": "function", "loc": [34, 39], "level": 0, "parent": null, "vector": [2, 0, 0.2005, 0.033, 0, 0.66, 0.75, 622, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "create_preferences_wave", "arg_names": ["robot", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_preferences_wave(robot, participant):\n domain = participant.split('@')[1]\n participants = [ constants.ROBOT_ADDRESS, SETTIE_ROBOT, participant ]\n prefs_wavelet = robot.new_wave(domain, participants, submit=True)\n update_preferences_wavelet(prefs_wavelet, participant, force=True)\n robot.submit(prefs_wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L35_C4", "label": "domain =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "vector": [14, 1, 0.1923, 0.0055, 1, 0.09, 0.0, 438, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "domain", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " domain = participant.split('@')[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L36_C4", "label": "participants =", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "vector": [14, 1, 0.1978, 0.0055, 1, 0.09, 0.25, 572, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " participants = [ constants.ROBOT_ADDRESS, SETTIE_ROBOT, participant ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L37_C4", "label": "prefs_wavelet = new_wave()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "vector": [14, 1, 0.2033, 0.0055, 1, 0.09, 0.5, 641, 3, 3, 0, 0, 669, 10, 1], "semantic": {"name": "prefs_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "new_wave", "annotation": ""}, "snippet": " prefs_wavelet = robot.new_wave(domain, participants, submit=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L38_C4", "label": "update_preferences_wavelet()", "type": "expression", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "vector": [8, 1, 0.2088, 0.0055, 1, 0.09, 0.75, 132, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "update_preferences_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "update_preferences_wavelet", "annotation": ""}, "snippet": " update_preferences_wavelet(prefs_wavelet, participant, force=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L39_C4", "label": "submit()", "type": "expression", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "vector": [8, 1, 0.2143, 0.0055, 1, 0.09, 1.0, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "submit", "arg_names": [], "import_names": [], "rhs_call_name": "submit", "annotation": ""}, "snippet": " robot.submit(prefs_wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "label": "update_preferences_wavelet", "type": "function", "loc": [42, 88], "level": 0, "parent": null, "vector": [2, 0, 0.3571, 0.2582, 0, 0.66, 0.8125, 132, 0, 3, 0, 0, 0, 0, 29], "semantic": {"name": "update_preferences_wavelet", "arg_names": ["wavelet", "participant", "force"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def update_preferences_wavelet(wavelet, participant=None, force=False):\n if not force and wavelet.data_documents[VERSION_DATA_DOC] == PREFERENCES_VERSION: return\n\n participant = find_participant(wavelet, participant)\n pp = model.ParticipantPreferences.get_by_pk(participant)\n logging.debug('Updating preferences wave content for %s', participant)\n if force:\n pp.preferences_wave_id = wavelet.wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L43_C4", "label": "if", "type": "if", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [4, 1, 0.2363, 0.0055, 1, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not force and wavelet.data_documents[VERSION_DATA_DOC] == PREFERENCES_VERSION: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L43_C86", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L43_C4", "vector": [13, 2, 0.2363, 0.0055, 2, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not force and wavelet.data_documents[VERSION_DATA_DOC] == PREFERENCES_VERSION: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L45_C4", "label": "participant = find_participant()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.2473, 0.0055, 1, 0.8, 0.0667, 606, 3, 2, 0, 0, 14, 10, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "find_participant", "annotation": ""}, "snippet": " participant = find_participant(wavelet, participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L46_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.2527, 0.0055, 1, 0.8, 0.1333, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L47_C4", "label": "debug()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.2582, 0.0055, 1, 0.8, 0.2, 924, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('Updating preferences wave content for %s', participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4", "label": "if", "type": "if", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [4, 1, 0.2692, 0.0165, 1, 0.8, 0.2667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if force:\n pp.preferences_wave_id = wavelet.wave_id\n pp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L49_C8", "label": "pp.preferences_wave_id =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4", "vector": [14, 2, 0.2692, 0.0055, 2, 0.58, 0.0, 602, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pp.preferences_wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pp.preferences_wave_id = wavelet.wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L50_C8", "label": "put()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4", "vector": [8, 2, 0.2747, 0.0055, 2, 0.58, 1.0, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L52_C4", "label": "content =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.2857, 0.0055, 1, 0.8, 0.3333, 273, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L55_C4", "label": "append()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.3022, 0.0055, 1, 0.8, 0.4, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L58_C4", "label": "append()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.3187, 0.0055, 1, 0.8, 0.4667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "label": "if", "type": "if", "loc": [61, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [4, 1, 0.3654, 0.0659, 1, 0.8, 0.5333, 0, 7, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if pp.account_id:\n content += [ 'Phone account id: %s\\n' % pp.account_id ]\n\n query = model.Phone.all()\n query.filter('account_id =', pp.account_id)\n content += [ 'Phones associated with this account: %s\\n' % len(list(query)) ]\n\n query = model.ParticipantPreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L64_C8", "label": "query = all()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "vector": [14, 2, 0.3516, 0.0055, 2, 0.92, 0.0, 546, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " query = model.Phone.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L65_C8", "label": "filter()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "vector": [8, 2, 0.3571, 0.0055, 2, 0.92, 0.25, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " query.filter('account_id =', pp.account_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L68_C8", "label": "query = all()", "type": "assigned_variable", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "vector": [14, 2, 0.3736, 0.0055, 2, 0.92, 0.5, 546, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " query = model.ParticipantPreferences.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L69_C8", "label": "filter()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "vector": [8, 2, 0.3791, 0.0055, 2, 0.92, 0.75, 526, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "filter", "arg_names": [], "import_names": [], "rhs_call_name": "filter", "annotation": ""}, "snippet": " query.filter('account_id =', pp.account_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L72_C8", "label": "append()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "vector": [8, 2, 0.3956, 0.0055, 2, 0.92, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L74_C4", "label": "append()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.4066, 0.0055, 1, 0.8, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L77_C4", "label": "append()", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.4231, 0.0055, 1, 0.8, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " content.append('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L80_C4", "label": "delete()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [8, 1, 0.4396, 0.0055, 1, 0.8, 0.7333, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " wavelet.root_blip.all().delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L82_C4", "label": "assign", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.4505, 0.0055, 1, 0.8, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet.data_documents[PARTICIPANT_DATA_DOC] = participant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.456, 0.0055, 1, 0.8, 0.8667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet.data_documents[VERSION_DATA_DOC] = PREFERENCES_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L85_C4", "label": "wavelet.title =", "type": "assigned_variable", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [14, 1, 0.467, 0.0055, 1, 0.8, 0.9333, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet.title = 'Notifiy global preferences'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L87_C4", "label": "for c", "type": "for", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "vector": [6, 1, 0.4808, 0.011, 1, 0.8, 1.0, 411, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for c in content:\n wavelet.root_blip.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L88_C8", "label": "append()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L87_C4", "vector": [8, 2, 0.4835, 0.0055, 2, 0.32, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " wavelet.root_blip.append(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "label": "delete_preferences_wavelet", "type": "function", "loc": [91, 105], "level": 0, "parent": null, "vector": [2, 0, 0.5385, 0.0824, 0, 0.66, 0.875, 226, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "delete_preferences_wavelet", "arg_names": ["wavelet", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def delete_preferences_wavelet(wavelet, participant=None):\n if not wavelet: return\n\n if not participant:\n participant = find_participant(wavelet)\n\n pp = model.ParticipantPreferences.get_by_pk(participant)\n if not pp: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L92_C4", "label": "if", "type": "if", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [4, 1, 0.5055, 0.0055, 1, 0.16, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L92_C20", "label": "return", "type": "return", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L92_C4", "vector": [13, 2, 0.5055, 0.0055, 2, 0.23, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not wavelet: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L94_C4", "label": "if", "type": "if", "loc": [94, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [4, 1, 0.5192, 0.011, 1, 0.16, 0.1429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not participant:\n participant = find_participant(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L95_C8", "label": "participant = find_participant()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L94_C4", "vector": [14, 2, 0.522, 0.0055, 2, 0.25, 0.0, 606, 3, 1, 0, 0, 14, 10, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "find_participant", "annotation": ""}, "snippet": " participant = find_participant(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L97_C4", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [14, 1, 0.533, 0.0055, 1, 0.16, 0.2857, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L98_C4", "label": "if", "type": "if", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [4, 1, 0.5385, 0.0055, 1, 0.16, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pp: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L98_C15", "label": "return", "type": "return", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L98_C4", "vector": [13, 2, 0.5385, 0.0055, 2, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not pp: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L100_C4", "label": "prefs_wavelet = fetch_preferences_wavelet()", "type": "assigned_variable", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [14, 1, 0.5495, 0.0055, 1, 0.16, 0.5714, 641, 3, 2, 0, 0, 538, 10, 1], "semantic": {"name": "prefs_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_preferences_wavelet", "annotation": ""}, "snippet": " prefs_wavelet = fetch_preferences_wavelet(wavelet, pp.preferences_wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L101_C4", "label": "prefs_wavelet.title =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [14, 1, 0.5549, 0.0055, 1, 0.16, 0.7143, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefs_wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefs_wavelet.title = \"Please delete this wave\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L104_C4", "label": "delete()", "type": "expression", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [8, 1, 0.5714, 0.0055, 1, 0.16, 0.8571, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " prefs_wavelet.root_blip.all().delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L105_C4", "label": "submit()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "vector": [8, 1, 0.5769, 0.0055, 1, 0.16, 1.0, 487, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "submit", "arg_names": [], "import_names": [], "rhs_call_name": "submit", "annotation": ""}, "snippet": " wavelet.robot.submit(prefs_wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "label": "handle_event", "type": "function", "loc": [108, 141], "level": 0, "parent": null, "vector": [2, 0, 0.6841, 0.1868, 0, 0.66, 0.9375, 48, 0, 2, 0, 0, 0, 0, 23], "semantic": {"name": "handle_event", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def handle_event(event, wavelet):\n participant = find_participant(wavelet, event.modified_by)\n logging.debug('Preferences if %s == %s' % (participant, event.modified_by))\n if participant != event.modified_by: return\n\n if event.button_name == 'save_pp':\n pp = model.ParticipantPreferences.get_by_pk(participant)\n for t, f, p in [ (element.Check, bool, 'notify'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L109_C4", "label": "participant = find_participant()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "vector": [14, 1, 0.5989, 0.0055, 1, 0.92, 0.0, 606, 3, 2, 0, 0, 14, 10, 1], "semantic": {"name": "participant", "arg_names": [], "import_names": [], "rhs_call_name": "find_participant", "annotation": ""}, "snippet": " participant = find_participant(wavelet, event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L110_C4", "label": "debug()", "type": "expression", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "vector": [8, 1, 0.6044, 0.0055, 1, 0.92, 0.3333, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('Preferences if %s == %s' % (participant, event.modified_by))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L111_C4", "label": "if", "type": "if", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "vector": [4, 1, 0.6099, 0.0055, 1, 0.92, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participant != event.modified_by: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L111_C41", "label": "return", "type": "return", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L111_C4", "vector": [13, 2, 0.6099, 0.0055, 2, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participant != event.modified_by: return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "label": "if", "type": "if", "loc": [113, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "vector": [4, 1, 0.6978, 0.1593, 1, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 0, 21], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if event.button_name == 'save_pp':\n pp = model.ParticipantPreferences.get_by_pk(participant)\n for t, f, p in [ (element.Check, bool, 'notify'),\n (element.Input, str, 'email'),\n (element.Check, bool, 'notify_initial') ]:\n form_element = wavelet.root_blip.first(t, name=p).value()\n pp.__setattr__(p, f(form_element.value))\n wavelet.reply(templates.PREFERENCES_SAVED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L114_C8", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "vector": [14, 2, 0.6264, 0.0055, 2, 0.11, 0.0, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8", "label": "for t, f, p", "type": "for", "loc": [115, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "vector": [6, 2, 0.6429, 0.0275, 2, 0.11, 0.3333, 245, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "t, f, p", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t, f, p in [ (element.Check, bool, 'notify'),\n (element.Input, str, 'email'),\n (element.Check, bool, 'notify_initial') ]:\n form_element = wavelet.root_blip.first(t, name=p).value()\n pp.__setattr__(p, f(form_element.value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L118_C12", "label": "form_element = value()", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8", "vector": [14, 3, 0.6484, 0.0055, 3, 0.08, 0.0, 67, 3, 0, 0, 0, 441, 10, 2], "semantic": {"name": "form_element", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " form_element = wavelet.root_blip.first(t, name=p).value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L119_C12", "label": "__setattr__()", "type": "expression", "loc": [119, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8", "vector": [8, 3, 0.6538, 0.0055, 3, 0.08, 1.0, 112, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__setattr__", "arg_names": [], "import_names": [], "rhs_call_name": "__setattr__", "annotation": ""}, "snippet": " pp.__setattr__(p, f(form_element.value))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L120_C8", "label": "reply()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "vector": [8, 2, 0.6593, 0.0055, 2, 0.11, 0.6667, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.PREFERENCES_SAVED)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4", "label": "if", "type": "if", "loc": [122, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "vector": [4, 2, 0.7225, 0.1099, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif event.button_name == 'refresh_pp':\n if ExecHandler(event, wavelet).refresh():\n wavelet.reply(templates.COMMAND_SUCCESSFUL % 'refresh')\n else:\n wavelet.reply(templates.ERROR_TRY_AGAIN)\n\n elif event.button_name == 'exec_pp':\n eh = ExecHandler(event, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8", "label": "if", "type": "if", "loc": [123, 126], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4", "vector": [4, 3, 0.6841, 0.022, 3, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ExecHandler(event, wavelet).refresh():\n wavelet.reply(templates.COMMAND_SUCCESSFUL % 'refresh')\n else:\n wavelet.reply(templates.ERROR_TRY_AGAIN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L124_C12", "label": "reply()", "type": "expression", "loc": [124, 124], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8", "vector": [8, 4, 0.6813, 0.0055, 4, 0.86, 0.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.COMMAND_SUCCESSFUL % 'refresh')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L126_C12", "label": "reply()", "type": "expression", "loc": [126, 126], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8", "vector": [8, 4, 0.6923, 0.0055, 4, 0.86, 1.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.ERROR_TRY_AGAIN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "label": "if", "type": "if", "loc": [128, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4", "vector": [4, 3, 0.739, 0.0769, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif event.button_name == 'exec_pp':\n eh = ExecHandler(event, wavelet)\n form_element = wavelet.root_blip.first(element.Input, name='command').value()\n command = form_element.value.split(' ')\n if hasattr(eh, command[0]):\n result = getattr(eh, command[0])(*command[1:])\n if result == True:\n wavelet.reply(templates.COMMAND_SUCCESSFUL % form_element.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L129_C8", "label": "eh = ExecHandler()", "type": "assigned_variable", "loc": [129, 129], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "vector": [14, 4, 0.7088, 0.0055, 4, 0.98, 0.0, 879, 3, 2, 0, 0, 201, 10, 1], "semantic": {"name": "eh", "arg_names": [], "import_names": [], "rhs_call_name": "ExecHandler", "annotation": ""}, "snippet": " eh = ExecHandler(event, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L130_C8", "label": "form_element = value()", "type": "assigned_variable", "loc": [130, 130], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "vector": [14, 4, 0.7143, 0.0055, 4, 0.98, 0.3333, 67, 3, 0, 0, 0, 441, 10, 2], "semantic": {"name": "form_element", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " form_element = wavelet.root_blip.first(element.Input, name='command').value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L131_C8", "label": "command = split()", "type": "assigned_variable", "loc": [131, 131], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "vector": [14, 4, 0.7198, 0.0055, 4, 0.98, 0.6667, 842, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "command", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " command = form_element.value.split(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "label": "if", "type": "if", "loc": [132, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "vector": [4, 4, 0.75, 0.0549, 4, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if hasattr(eh, command[0]):\n result = getattr(eh, command[0])(*command[1:])\n if result == True:\n wavelet.reply(templates.COMMAND_SUCCESSFUL % form_element.value)\n elif result == False:\n wavelet.reply(templates.ERROR_TRY_AGAIN)\n elif result:\n wavelet.reply(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L133_C12", "label": "result =", "type": "assigned_variable", "loc": [133, 133], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "vector": [14, 5, 0.7308, 0.0055, 5, 0.83, 0.0, 51, 3, 1, 0, 0, 0, 10, 2], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = getattr(eh, command[0])(*command[1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12", "label": "if", "type": "if", "loc": [134, 139], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "vector": [4, 5, 0.75, 0.033, 5, 0.83, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if result == True:\n wavelet.reply(templates.COMMAND_SUCCESSFUL % form_element.value)\n elif result == False:\n wavelet.reply(templates.ERROR_TRY_AGAIN)\n elif result:\n wavelet.reply(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L135_C16", "label": "reply()", "type": "expression", "loc": [135, 135], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12", "vector": [8, 6, 0.7418, 0.0055, 6, 0.31, 0.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.COMMAND_SUCCESSFUL % form_element.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12", "label": "if", "type": "if", "loc": [136, 139], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12", "vector": [4, 6, 0.7555, 0.022, 6, 0.31, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif result == False:\n wavelet.reply(templates.ERROR_TRY_AGAIN)\n elif result:\n wavelet.reply(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L137_C16", "label": "reply()", "type": "expression", "loc": [137, 137], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12", "vector": [8, 7, 0.7527, 0.0055, 7, 0.96, 0.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.ERROR_TRY_AGAIN)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L138_C12", "label": "if", "type": "if", "loc": [138, 139], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12", "vector": [4, 7, 0.761, 0.011, 7, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif result:\n wavelet.reply(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L139_C16", "label": "reply()", "type": "expression", "loc": [139, 139], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L138_C12", "vector": [8, 8, 0.7637, 0.0055, 8, 0.31, 0.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(result)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L141_C12", "label": "reply()", "type": "expression", "loc": [141, 141], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "vector": [8, 5, 0.7747, 0.0055, 5, 0.83, 1.0, 714, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply(templates.COMMAND_UNKNOWN % command)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "label": "ExecHandler", "type": "class", "loc": [144, 182], "level": 0, "parent": null, "vector": [3, 0, 0.8956, 0.2143, 0, 0.66, 1.0, 201, 0, 7, 0, 0, 186, 0, 14], "semantic": {"name": "ExecHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ExecHandler(object):\n\n def __init__(self, event, wavelet):\n self.event = event\n self.wavelet = wavelet\n\n def help(self):\n logging.debug('ExecHandler help')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4", "label": "__init__", "type": "function", "loc": [146, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.8077, 0.0165, 1, 0.81, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, event, wavelet):\n self.event = event\n self.wavelet = wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L147_C8", "label": "self.event =", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4", "vector": [14, 2, 0.8077, 0.0055, 2, 0.82, 0.0, 752, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.event = event"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L148_C8", "label": "self.wavelet =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4", "vector": [14, 2, 0.8132, 0.0055, 2, 0.82, 1.0, 288, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet = wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4", "label": "help", "type": "function", "loc": [150, 152], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.8297, 0.0165, 1, 0.81, 0.1667, 868, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "help", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def help(self):\n logging.debug('ExecHandler help')\n return templates.COMMANDS_HELP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L151_C8", "label": "debug()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4", "vector": [8, 2, 0.8297, 0.0055, 2, 0.42, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('ExecHandler help')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L152_C8", "label": "return", "type": "return", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4", "vector": [13, 2, 0.8352, 0.0055, 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 templates.COMMANDS_HELP"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "label": "refresh", "type": "function", "loc": [154, 157], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.8544, 0.022, 1, 0.81, 0.3333, 804, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "refresh", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def refresh(self):\n logging.debug('ExecHandler refresh')\n update_preferences_wavelet(self.wavelet, self.event.modified_by, force=True)\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L155_C8", "label": "debug()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "vector": [8, 2, 0.8516, 0.0055, 2, 0.13, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('ExecHandler refresh')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L156_C8", "label": "update_preferences_wavelet()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "vector": [8, 2, 0.8571, 0.0055, 2, 0.13, 0.5, 132, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "update_preferences_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "update_preferences_wavelet", "annotation": ""}, "snippet": " update_preferences_wavelet(self.wavelet, self.event.modified_by, force=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L157_C8", "label": "return", "type": "return", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "vector": [13, 2, 0.8626, 0.0055, 2, 0.13, 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_1107:FunctionDef_L159_C4", "label": "clean", "type": "function", "loc": [159, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.8929, 0.044, 1, 0.81, 0.5, 517, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "clean", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clean(self):\n logging.debug('ExecHandler clean')\n delete = []\n for blip_id in self.wavelet.blips:\n if blip_id != self.wavelet.root_blip.blip_id:\n delete.append(blip_id)\n for blip_id in delete:\n self.wavelet.delete(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L160_C8", "label": "debug()", "type": "expression", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "vector": [8, 2, 0.8791, 0.0055, 2, 0.08, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('ExecHandler clean')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L161_C8", "label": "delete =", "type": "assigned_variable", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "vector": [14, 2, 0.8846, 0.0055, 2, 0.08, 0.3333, 266, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " delete = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L162_C8", "label": "for blip_id", "type": "for", "loc": [162, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "vector": [6, 2, 0.8956, 0.0165, 2, 0.08, 0.6667, 161, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for blip_id in self.wavelet.blips:\n if blip_id != self.wavelet.root_blip.blip_id:\n delete.append(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L163_C12", "label": "if", "type": "if", "loc": [163, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L162_C8", "vector": [4, 3, 0.8984, 0.011, 3, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if blip_id != self.wavelet.root_blip.blip_id:\n delete.append(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L164_C16", "label": "append()", "type": "expression", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L163_C12", "vector": [8, 4, 0.9011, 0.0055, 4, 0.48, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " delete.append(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L165_C8", "label": "for blip_id", "type": "for", "loc": [165, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "vector": [6, 2, 0.9093, 0.011, 2, 0.08, 1.0, 161, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for blip_id in delete:\n self.wavelet.delete(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L166_C12", "label": "delete()", "type": "expression", "loc": [166, 166], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L165_C8", "vector": [8, 3, 0.9121, 0.0055, 3, 0.88, 0.0, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.wavelet.delete(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4", "label": "reset", "type": "function", "loc": [168, 170], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.9286, 0.0165, 1, 0.81, 0.6667, 944, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reset(self):\n logging.debug('ExecHandler reset')\n return \"Not implemented yet\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L169_C8", "label": "debug()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4", "vector": [8, 2, 0.9286, 0.0055, 2, 0.21, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('ExecHandler reset')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L170_C8", "label": "return", "type": "return", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4", "vector": [13, 2, 0.9341, 0.0055, 2, 0.21, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"Not implemented yet\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "label": "regen", "type": "function", "loc": [172, 176], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.956, 0.0275, 1, 0.81, 0.8333, 570, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "regen", "arg_names": ["self", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def regen(self, participant=None):\n pp = model.ParticipantPreferences.get_by_pk(participant or self.event.modified_by)\n pp.activation = model.random_activation()\n pp.put()\n return self.refresh()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L173_C8", "label": "pp = get_by_pk()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "vector": [14, 2, 0.9505, 0.0055, 2, 0.76, 0.0, 632, 3, 1, 0, 0, 243, 10, 1], "semantic": {"name": "pp", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_pk", "annotation": ""}, "snippet": " pp = model.ParticipantPreferences.get_by_pk(participant or self.event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L174_C8", "label": "pp.activation = random_activation()", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "vector": [14, 2, 0.956, 0.0055, 2, 0.76, 0.3333, 260, 3, 0, 0, 0, 439, 10, 1], "semantic": {"name": "pp.activation", "arg_names": [], "import_names": [], "rhs_call_name": "random_activation", "annotation": ""}, "snippet": " pp.activation = model.random_activation()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L175_C8", "label": "put()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "vector": [8, 2, 0.9615, 0.0055, 2, 0.76, 0.6667, 636, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " pp.put()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L176_C8", "label": "return", "type": "return", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "vector": [13, 2, 0.967, 0.0055, 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 self.refresh()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "label": "recreate", "type": "function", "loc": [178, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "vector": [2, 1, 0.989, 0.0275, 1, 0.81, 1.0, 554, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "recreate", "arg_names": ["self", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def recreate(self, participant=None):\n logging.debug('ExecHandler recreate')\n delete_preferences_wavelet(self.wavelet, participant or self.event.modified_by)\n create_preferences_wave(self.wavelet.robot, participant or self.event.modified_by)\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L179_C8", "label": "debug()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "vector": [8, 2, 0.9835, 0.0055, 2, 0.28, 0.0, 924, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "debug", "arg_names": [], "import_names": [], "rhs_call_name": "debug", "annotation": ""}, "snippet": " logging.debug('ExecHandler recreate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L180_C8", "label": "delete_preferences_wavelet()", "type": "expression", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "vector": [8, 2, 0.989, 0.0055, 2, 0.28, 0.3333, 226, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "delete_preferences_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "delete_preferences_wavelet", "annotation": ""}, "snippet": " delete_preferences_wavelet(self.wavelet, participant or self.event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L181_C8", "label": "create_preferences_wave()", "type": "expression", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "vector": [8, 2, 0.9945, 0.0055, 2, 0.28, 0.6667, 622, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "create_preferences_wave", "arg_names": [], "import_names": [], "rhs_call_name": "create_preferences_wave", "annotation": ""}, "snippet": " create_preferences_wave(self.wavelet.robot, participant or self.event.modified_by)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L182_C8", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "vector": [13, 2, 1.0, 0.0055, 2, 0.28, 1.0, 0, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L23_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L43_C86"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L65_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L88_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L92_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L94_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L95_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L98_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L98_C15"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L111_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L111_C41"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L119_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L120_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L124_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L123_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L129_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L131_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L128_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L133_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L135_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L134_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L137_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L136_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L138_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L138_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L139_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L132_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L141_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L147_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L146_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L152_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L162_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L162_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L163_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:If_L163_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L164_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L159_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:For_L165_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L166_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L168_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L170_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L173_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Assign_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L175_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L172_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:ClassDef_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L179_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Expr_L181_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1107:FunctionDef_L178_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1107:Return_L182_C8"}] |
# -*- coding: UTF-8 -*-
###################################################
# General mail template
###################################################
MESSAGE_TEMPLATE = u'''\
%s
---
Reply to this message to add a blip to the wave
Visit this wave: %s
Change global notification preferences: %s
To unsubscribe please visit your preferences or send an email to: %s
'''
NOTIFY_ONCE_TEMPLATE = u'''\
%s
[NOTE: you will not recive further messages until you visit this wave]
'''
###################################################
# Individual email messages
###################################################
INITIAL_MESSAGE = u'To receive email notifications visit this wave and activate them.'
ROBOT_ADDED = u'The notifiy robot has been added to this wave. '
ADDED_MESSAGE = u'%s added you as a participant to this wave.'
CONTENT_DELETED = u'Some content was deleted from the wave'
CONTENT_SUPRESSED = u'%s... [some content was supressed]'
PHONE_MESSAGE = '[wave] %s: %s'
###################################################
# Unsubscribed messages
###################################################
UNSUBSCRIBED_SUBJECT = u'Unsubscribed'
UNSUBSCRIBED_BODY = u'Your email has been unsubscribed from the Notifiy robot. \
To receive notifications again please visit Google Wave and update your preferences. \
Your email may still show there, just click the refresh button.'
###################################################
# Preferences wave messages
###################################################
COMMANDS_HELP = u'''
help: Show this help
refresh: Recreate the preferences wave
clean: Clean all messages in this wave.
regen: Regenerate the activation code.
reset: Reset your specific wave preferenes (for all waves) and refresh this form.
'''
COMMAND_SUCCESSFUL = u'Command %s ran successfully'
COMMAND_UNKNOWN = u'Command %s not found'
PREFERENCES_SAVED = u'Preferences saved'
ERROR_TRY_AGAIN = u'There was an error, please try again in a few moments'
###################################################
# Error messages
###################################################
ERROR_BODY = u'''Your message "%s" could not be processed because of the following error:
%s
=========================
ORIGINAL MESSAGE FOLLOWS:
=========================
%s
'''
| ajibawa-2023/Python-Code-Large/train/row_1108 | 16 | 82 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L7_C0", "label": "MESSAGE_TEMPLATE =", "type": "assigned_variable", "loc": [7, 15], "level": 0, "parent": null, "vector": [14, 0, 0.1341, 0.1098, 0, 0.66, 0.0, 755, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MESSAGE_TEMPLATE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MESSAGE_TEMPLATE = u'''\\\n%s\n\n---\nReply to this message to add a blip to the wave\nVisit this wave: %s\nChange global notification preferences: %s\nTo unsubscribe please visit your preferences or send an email to: %s"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L17_C0", "label": "NOTIFY_ONCE_TEMPLATE =", "type": "assigned_variable", "loc": [17, 21], "level": 0, "parent": null, "vector": [14, 0, 0.2317, 0.061, 0, 0.66, 0.0667, 373, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NOTIFY_ONCE_TEMPLATE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NOTIFY_ONCE_TEMPLATE = u'''\\\n%s\n\n[NOTE: you will not recive further messages until you visit this wave]\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L27_C0", "label": "INITIAL_MESSAGE =", "type": "assigned_variable", "loc": [27, 27], "level": 0, "parent": null, "vector": [14, 0, 0.3293, 0.0122, 0, 0.66, 0.1333, 604, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INITIAL_MESSAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INITIAL_MESSAGE = u'To receive email notifications visit this wave and activate them.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L29_C0", "label": "ROBOT_ADDED =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.3537, 0.0122, 0, 0.66, 0.2, 540, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_ADDED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_ADDED = u'The notifiy robot has been added to this wave. '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L31_C0", "label": "ADDED_MESSAGE =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.378, 0.0122, 0, 0.66, 0.2667, 194, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ADDED_MESSAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ADDED_MESSAGE = u'%s added you as a participant to this wave.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L33_C0", "label": "CONTENT_DELETED =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4024, 0.0122, 0, 0.66, 0.3333, 934, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CONTENT_DELETED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CONTENT_DELETED = u'Some content was deleted from the wave'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L35_C0", "label": "CONTENT_SUPRESSED =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.4268, 0.0122, 0, 0.66, 0.4, 944, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CONTENT_SUPRESSED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CONTENT_SUPRESSED = u'%s... [some content was supressed]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L37_C0", "label": "PHONE_MESSAGE =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.4512, 0.0122, 0, 0.66, 0.4667, 263, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PHONE_MESSAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PHONE_MESSAGE = '[wave] %s: %s'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L43_C0", "label": "UNSUBSCRIBED_SUBJECT =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.5244, 0.0122, 0, 0.66, 0.5333, 898, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNSUBSCRIBED_SUBJECT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "UNSUBSCRIBED_SUBJECT = u'Unsubscribed'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L45_C0", "label": "UNSUBSCRIBED_BODY =", "type": "assigned_variable", "loc": [45, 47], "level": 0, "parent": null, "vector": [14, 0, 0.561, 0.0366, 0, 0.66, 0.6, 178, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UNSUBSCRIBED_BODY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "UNSUBSCRIBED_BODY = u'Your email has been unsubscribed from the Notifiy robot. \\\nTo receive notifications again please visit Google Wave and update your preferences. \\\nYour email may still show there, just click the refresh button.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L53_C0", "label": "COMMANDS_HELP =", "type": "assigned_variable", "loc": [53, 59], "level": 0, "parent": null, "vector": [14, 0, 0.6829, 0.0854, 0, 0.66, 0.6667, 325, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COMMANDS_HELP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMMANDS_HELP = u'''\nhelp: Show this help\nrefresh: Recreate the preferences wave\nclean: Clean all messages in this wave.\nregen: Regenerate the activation code.\nreset: Reset your specific wave preferenes (for all waves) and refresh this form.\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L61_C0", "label": "COMMAND_SUCCESSFUL =", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.7439, 0.0122, 0, 0.66, 0.7333, 812, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COMMAND_SUCCESSFUL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMMAND_SUCCESSFUL = u'Command %s ran successfully'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L63_C0", "label": "COMMAND_UNKNOWN =", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.7683, 0.0122, 0, 0.66, 0.8, 752, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COMMAND_UNKNOWN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COMMAND_UNKNOWN = u'Command %s not found'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L65_C0", "label": "PREFERENCES_SAVED =", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.7927, 0.0122, 0, 0.66, 0.8667, 934, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PREFERENCES_SAVED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PREFERENCES_SAVED = u'Preferences saved'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L67_C0", "label": "ERROR_TRY_AGAIN =", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 0.8171, 0.0122, 0, 0.66, 0.9333, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ERROR_TRY_AGAIN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ERROR_TRY_AGAIN = u'There was an error, please try again in a few moments'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1108:Assign_L73_C0", "label": "ERROR_BODY =", "type": "assigned_variable", "loc": [73, 82], "level": 0, "parent": null, "vector": [14, 0, 0.9451, 0.122, 0, 0.66, 1.0, 329, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ERROR_BODY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ERROR_BODY = u'''Your message \"%s\" could not be processed because of the following error:\n\n%s\n\n=========================\nORIGINAL MESSAGE FOLLOWS:\n=========================\n"}] | [] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the element module."""
import base64
import unittest
import element
import util
class TestElement(unittest.TestCase):
"""Tests for the element.Element class."""
def testProperties(self):
el = element.Element(element.Gadget.class_type,
key='value')
self.assertEquals('value', el.key)
def testFormElement(self):
el = element.Input('input')
self.assertEquals(element.Input.class_type, el.type)
self.assertEquals(el.value, '')
self.assertEquals(el.name, 'input')
def testImage(self):
image = element.Image('http://test.com/image.png', width=100, height=100)
self.assertEquals(element.Image.class_type, image.type)
self.assertEquals(image.url, 'http://test.com/image.png')
self.assertEquals(image.width, 100)
self.assertEquals(image.height, 100)
def testAttachment(self):
attachment = element.Attachment(caption='My Favorite', data='SomefakeData')
self.assertEquals(element.Attachment.class_type, attachment.type)
self.assertEquals(attachment.caption, 'My Favorite')
self.assertEquals(attachment.data, 'SomefakeData')
def testGadget(self):
gadget = element.Gadget('http://test.com/gadget.xml')
self.assertEquals(element.Gadget.class_type, gadget.type)
self.assertEquals(gadget.url, 'http://test.com/gadget.xml')
def testInstaller(self):
installer = element.Installer('http://test.com/installer.xml')
self.assertEquals(element.Installer.class_type, installer.type)
self.assertEquals(installer.manifest, 'http://test.com/installer.xml')
def testSerialize(self):
image = element.Image('http://test.com/image.png', width=100, height=100)
s = util.serialize(image)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 3)
self.assertEquals(props['url'], 'http://test.com/image.png')
self.assertEquals(props['width'], 100)
self.assertEquals(props['height'], 100)
def testSerializeAttachment(self):
attachment = element.Attachment(caption='My Favorite', data='SomefakeData')
s = util.serialize(attachment)
k = s.keys()
k.sort()
# we should really have two things to serialize
props = s['properties']
self.assertEquals(len(props), 2)
self.assertEquals(props['caption'], 'My Favorite')
self.assertEquals(props['data'], base64.encodestring('SomefakeData'))
self.assertEquals(attachment.data, 'SomefakeData')
def testSerializeLine(self):
line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)
s = util.serialize(line)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 2)
self.assertEquals(props['alignment'], 'l')
self.assertEquals(props['lineType'], 'h1')
def testSerializeGadget(self):
gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None})
s = util.serialize(gadget)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 3)
self.assertEquals(props['url'], 'http://test.com')
self.assertEquals(props['prop1'], 'a')
self.assertEquals(props['prop_cap'], None)
def testGadgetElementFromJson(self):
url = 'http://www.foo.com/gadget.xml'
json = {
'type': element.Gadget.class_type,
'properties': {
'url': url,
}
}
gadget = element.Element.from_json(json)
self.assertEquals(element.Gadget.class_type, gadget.type)
self.assertEquals(url, gadget.url)
def testImageElementFromJson(self):
url = 'http://www.foo.com/image.png'
width = '32'
height = '32'
attachment_id = '2'
caption = 'Test Image'
json = {
'type': element.Image.class_type,
'properties': {
'url': url,
'width': width,
'height': height,
'attachmentId': attachment_id,
'caption': caption,
}
}
image = element.Element.from_json(json)
self.assertEquals(element.Image.class_type, image.type)
self.assertEquals(url, image.url)
self.assertEquals(width, image.width)
self.assertEquals(height, image.height)
self.assertEquals(attachment_id, image.attachmentId)
self.assertEquals(caption, image.caption)
def testAttachmentElementFromJson(self):
caption = 'fake caption'
data = 'fake data'
mime_type = 'fake mime'
attachment_id = 'fake id'
attachment_url = 'fake URL'
json = {
'type': element.Attachment.class_type,
'properties': {
'caption': caption,
'data': data,
'mimeType': mime_type,
'attachmentId': attachment_id,
'attachmentUrl': attachment_url,
}
}
attachment = element.Element.from_json(json)
self.assertEquals(element.Attachment.class_type, attachment.type)
self.assertEquals(caption, attachment.caption)
self.assertEquals(data, attachment.data)
self.assertEquals(mime_type, attachment.mimeType)
self.assertEquals(attachment_id, attachment.attachmentId)
self.assertEquals(attachment_url, attachment.attachmentUrl)
def testFormElementFromJson(self):
name = 'button'
value = 'value'
default_value = 'foo'
json = {
'type': element.Label.class_type,
'properties': {
'name': name,
'value': value,
'defaultValue': default_value,
}
}
el = element.Element.from_json(json)
self.assertEquals(element.Label.class_type, el.type)
self.assertEquals(name, el.name)
self.assertEquals(value, el.value)
def testCanInstantiate(self):
bag = [element.Check(name='check', value='value'),
element.Button(name='button', value='caption'),
element.Input(name='input', value='caption'),
element.Label(label_for='button', caption='caption'),
element.RadioButton(name='name', group='group'),
element.RadioButtonGroup(name='name', value='value'),
element.Password(name='name', value='geheim'),
element.TextArea(name='name', value='\n\n\n'),
element.Installer(manifest='test.com/installer.xml'),
element.Line(line_type='type',
indent='3',
alignment='r',
direction='d'),
element.Gadget(url='test.com/gadget.xml',
props={'key1': 'val1', 'key2': 'val2'}),
element.Image(url='test.com/image.png', width=100, height=200),
element.Attachment(caption='fake caption', data='fake data')]
types_constructed = set([type(x) for x in bag])
types_required = set(element.ALL.values())
missing_required = types_constructed.difference(types_required)
self.assertEquals(missing_required, set())
missing_constructed = types_required.difference(types_constructed)
self.assertEquals(missing_constructed, set())
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1110 | 126 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0791, 0.0047, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the element module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Import_L20_C0", "label": "base64 import base64", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.093, 0.0047, 0, 0.66, 0.1667, 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_1110:Import_L21_C0", "label": "unittest import unittest", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0977, 0.0047, 0, 0.66, 0.3333, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.107, 0.0047, 0, 0.66, 0.5, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Import_L24_C0", "label": "util import util", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1116, 0.0047, 0, 0.66, 0.6667, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "label": "TestElement", "type": "class", "loc": [27, 211], "level": 0, "parent": null, "vector": [3, 0, 0.5535, 0.8605, 0, 0.66, 0.8333, 876, 0, 15, 0, 0, 878, 0, 99], "semantic": {"name": "TestElement", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestElement(unittest.TestCase):\n \"\"\"Tests for the element.Element class.\"\"\"\n\n def testProperties(self):\n el = element.Element(element.Gadget.class_type,\n key='value')\n self.assertEquals('value', el.key)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L28_C2", "label": "expression", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [8, 1, 0.1302, 0.0047, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests for the element.Element class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2", "label": "testProperties", "type": "function", "loc": [30, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.1465, 0.0186, 1, 0.44, 0.0667, 59, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testProperties(self):\n el = element.Element(element.Gadget.class_type,\n key='value')\n self.assertEquals('value', el.key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L31_C4", "label": "el = Element()", "type": "assigned_variable", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2", "vector": [14, 2, 0.1465, 0.0093, 2, 0.98, 0.0, 144, 3, 2, 0, 0, 873, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "Element", "annotation": ""}, "snippet": " el = element.Element(element.Gadget.class_type,\n key='value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L33_C4", "label": "assertEquals()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2", "vector": [8, 2, 0.1535, 0.0047, 2, 0.98, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('value', el.key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "label": "testFormElement", "type": "function", "loc": [35, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.1721, 0.0233, 1, 0.44, 0.1333, 695, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testFormElement", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFormElement(self):\n el = element.Input('input')\n self.assertEquals(element.Input.class_type, el.type)\n self.assertEquals(el.value, '')\n self.assertEquals(el.name, 'input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L36_C4", "label": "el = Input()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "vector": [14, 2, 0.1674, 0.0047, 2, 0.52, 0.0, 144, 3, 1, 0, 0, 35, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "Input", "annotation": ""}, "snippet": " el = element.Input('input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L37_C4", "label": "assertEquals()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "vector": [8, 2, 0.1721, 0.0047, 2, 0.52, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Input.class_type, el.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L38_C4", "label": "assertEquals()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "vector": [8, 2, 0.1767, 0.0047, 2, 0.52, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(el.value, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L39_C4", "label": "assertEquals()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "vector": [8, 2, 0.1814, 0.0047, 2, 0.52, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(el.name, 'input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "label": "testImage", "type": "function", "loc": [41, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.2023, 0.0279, 1, 0.44, 0.2, 172, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testImage", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testImage(self):\n image = element.Image('http://test.com/image.png', width=100, height=100)\n self.assertEquals(element.Image.class_type, image.type)\n self.assertEquals(image.url, 'http://test.com/image.png')\n self.assertEquals(image.width, 100)\n self.assertEquals(image.height, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L42_C4", "label": "image = Image()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "vector": [14, 2, 0.1953, 0.0047, 2, 0.3, 0.0, 505, 3, 3, 0, 0, 721, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "Image", "annotation": ""}, "snippet": " image = element.Image('http://test.com/image.png', width=100, height=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L43_C4", "label": "assertEquals()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "vector": [8, 2, 0.2, 0.0047, 2, 0.3, 0.25, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Image.class_type, image.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L44_C4", "label": "assertEquals()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "vector": [8, 2, 0.2047, 0.0047, 2, 0.3, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.url, 'http://test.com/image.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L45_C4", "label": "assertEquals()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "vector": [8, 2, 0.2093, 0.0047, 2, 0.3, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.width, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L46_C4", "label": "assertEquals()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "vector": [8, 2, 0.214, 0.0047, 2, 0.3, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.height, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "label": "testAttachment", "type": "function", "loc": [48, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.2326, 0.0233, 1, 0.44, 0.2667, 181, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testAttachment", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAttachment(self):\n attachment = element.Attachment(caption='My Favorite', data='SomefakeData')\n self.assertEquals(element.Attachment.class_type, attachment.type)\n self.assertEquals(attachment.caption, 'My Favorite')\n self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L49_C4", "label": "attachment = Attachment()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "vector": [14, 2, 0.2279, 0.0047, 2, 0.16, 0.0, 113, 3, 2, 0, 0, 312, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "Attachment", "annotation": ""}, "snippet": " attachment = element.Attachment(caption='My Favorite', data='SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L50_C4", "label": "assertEquals()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "vector": [8, 2, 0.2326, 0.0047, 2, 0.16, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Attachment.class_type, attachment.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L51_C4", "label": "assertEquals()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "vector": [8, 2, 0.2372, 0.0047, 2, 0.16, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.caption, 'My Favorite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L52_C4", "label": "assertEquals()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "vector": [8, 2, 0.2419, 0.0047, 2, 0.16, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "label": "testGadget", "type": "function", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.2581, 0.0186, 1, 0.44, 0.3333, 832, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testGadget", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testGadget(self):\n gadget = element.Gadget('http://test.com/gadget.xml')\n self.assertEquals(element.Gadget.class_type, gadget.type)\n self.assertEquals(gadget.url, 'http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L55_C4", "label": "gadget = Gadget()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "vector": [14, 2, 0.2558, 0.0047, 2, 0.36, 0.0, 109, 3, 1, 0, 0, 136, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "Gadget", "annotation": ""}, "snippet": " gadget = element.Gadget('http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L56_C4", "label": "assertEquals()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "vector": [8, 2, 0.2605, 0.0047, 2, 0.36, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, gadget.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L57_C4", "label": "assertEquals()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "vector": [8, 2, 0.2651, 0.0047, 2, 0.36, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(gadget.url, 'http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "label": "testInstaller", "type": "function", "loc": [59, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.2814, 0.0186, 1, 0.44, 0.4, 185, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testInstaller", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInstaller(self):\n installer = element.Installer('http://test.com/installer.xml')\n self.assertEquals(element.Installer.class_type, installer.type)\n self.assertEquals(installer.manifest, 'http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L60_C4", "label": "installer = Installer()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "vector": [14, 2, 0.2791, 0.0047, 2, 0.08, 0.0, 244, 3, 1, 0, 0, 426, 10, 1], "semantic": {"name": "installer", "arg_names": [], "import_names": [], "rhs_call_name": "Installer", "annotation": ""}, "snippet": " installer = element.Installer('http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L61_C4", "label": "assertEquals()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "vector": [8, 2, 0.2837, 0.0047, 2, 0.08, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Installer.class_type, installer.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L62_C4", "label": "assertEquals()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "vector": [8, 2, 0.2884, 0.0047, 2, 0.08, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(installer.manifest, 'http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "label": "testSerialize", "type": "function", "loc": [64, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.3209, 0.0512, 1, 0.44, 0.4667, 465, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n image = element.Image('http://test.com/image.png', width=100, height=100)\n s = util.serialize(image)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L65_C4", "label": "image = Image()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [14, 2, 0.3023, 0.0047, 2, 0.0, 0.0, 505, 3, 3, 0, 0, 721, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "Image", "annotation": ""}, "snippet": " image = element.Image('http://test.com/image.png', width=100, height=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L66_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [14, 2, 0.307, 0.0047, 2, 0.0, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L67_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [14, 2, 0.3116, 0.0047, 2, 0.0, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L68_C4", "label": "sort()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [8, 2, 0.3163, 0.0047, 2, 0.0, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L70_C4", "label": "props =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [14, 2, 0.3256, 0.0047, 2, 0.0, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [8, 2, 0.3302, 0.0047, 2, 0.0, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [8, 2, 0.3349, 0.0047, 2, 0.0, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['url'], 'http://test.com/image.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [8, 2, 0.3395, 0.0047, 2, 0.0, 0.875, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['width'], 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "vector": [8, 2, 0.3442, 0.0047, 2, 0.0, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['height'], 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "label": "testSerializeAttachment", "type": "function", "loc": [76, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.3767, 0.0512, 1, 0.44, 0.5333, 631, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testSerializeAttachment", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeAttachment(self):\n attachment = element.Attachment(caption='My Favorite', data='SomefakeData')\n s = util.serialize(attachment)\n k = s.keys()\n k.sort()\n # we should really have two things to serialize\n props = s['properties']\n self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L77_C4", "label": "attachment = Attachment()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [14, 2, 0.3581, 0.0047, 2, 0.8, 0.0, 113, 3, 2, 0, 0, 312, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "Attachment", "annotation": ""}, "snippet": " attachment = element.Attachment(caption='My Favorite', data='SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L78_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [14, 2, 0.3628, 0.0047, 2, 0.8, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(attachment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L79_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [14, 2, 0.3674, 0.0047, 2, 0.8, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L80_C4", "label": "sort()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [8, 2, 0.3721, 0.0047, 2, 0.8, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L82_C4", "label": "props =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [14, 2, 0.3814, 0.0047, 2, 0.8, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [8, 2, 0.386, 0.0047, 2, 0.8, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L84_C4", "label": "assertEquals()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [8, 2, 0.3907, 0.0047, 2, 0.8, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['caption'], 'My Favorite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L85_C4", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [8, 2, 0.3953, 0.0047, 2, 0.8, 0.875, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['data'], base64.encodestring('SomefakeData'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "vector": [8, 2, 0.4, 0.0047, 2, 0.8, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "label": "testSerializeLine", "type": "function", "loc": [88, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.4302, 0.0465, 1, 0.44, 0.6, 355, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testSerializeLine", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeLine(self):\n line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)\n s = util.serialize(line)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L89_C4", "label": "line = Line()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [14, 2, 0.414, 0.0047, 2, 0.55, 0.0, 373, 3, 2, 0, 0, 650, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "Line", "annotation": ""}, "snippet": " line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L90_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [14, 2, 0.4186, 0.0047, 2, 0.55, 0.1429, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L91_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [14, 2, 0.4233, 0.0047, 2, 0.55, 0.2857, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L92_C4", "label": "sort()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [8, 2, 0.4279, 0.0047, 2, 0.55, 0.4286, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L94_C4", "label": "props =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [14, 2, 0.4372, 0.0047, 2, 0.55, 0.5714, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [8, 2, 0.4419, 0.0047, 2, 0.55, 0.7143, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L96_C4", "label": "assertEquals()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [8, 2, 0.4465, 0.0047, 2, 0.55, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['alignment'], 'l')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L97_C4", "label": "assertEquals()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "vector": [8, 2, 0.4512, 0.0047, 2, 0.55, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['lineType'], 'h1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "label": "testSerializeGadget", "type": "function", "loc": [99, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.4837, 0.0512, 1, 0.44, 0.6667, 505, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSerializeGadget", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeGadget(self):\n gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None}) \n s = util.serialize(gadget)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L100_C4", "label": "gadget = Gadget()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [14, 2, 0.4651, 0.0047, 2, 0.75, 0.0, 109, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "Gadget", "annotation": ""}, "snippet": " gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None}) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L101_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [14, 2, 0.4698, 0.0047, 2, 0.75, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(gadget)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L102_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [14, 2, 0.4744, 0.0047, 2, 0.75, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L103_C4", "label": "sort()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [8, 2, 0.4791, 0.0047, 2, 0.75, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L105_C4", "label": "props =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [14, 2, 0.4884, 0.0047, 2, 0.75, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [8, 2, 0.493, 0.0047, 2, 0.75, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [8, 2, 0.4977, 0.0047, 2, 0.75, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['url'], 'http://test.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [8, 2, 0.5023, 0.0047, 2, 0.75, 0.875, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['prop1'], 'a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L109_C4", "label": "assertEquals()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "vector": [8, 2, 0.507, 0.0047, 2, 0.75, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['prop_cap'], None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "label": "testGadgetElementFromJson", "type": "function", "loc": [111, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.5395, 0.0512, 1, 0.44, 0.7333, 203, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testGadgetElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testGadgetElementFromJson(self):\n url = 'http://www.foo.com/gadget.xml'\n json = {\n 'type': element.Gadget.class_type,\n 'properties': {\n 'url': url,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L112_C4", "label": "url =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "vector": [14, 2, 0.5209, 0.0047, 2, 0.28, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.foo.com/gadget.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L113_C4", "label": "json =", "type": "assigned_variable", "loc": [113, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "vector": [14, 2, 0.5372, 0.0279, 2, 0.28, 0.25, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Gadget.class_type,\n 'properties': {\n 'url': url,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L119_C4", "label": "gadget = from_json()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "vector": [14, 2, 0.5535, 0.0047, 2, 0.28, 0.5, 109, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " gadget = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L120_C4", "label": "assertEquals()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "vector": [8, 2, 0.5581, 0.0047, 2, 0.28, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, gadget.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L121_C4", "label": "assertEquals()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "vector": [8, 2, 0.5628, 0.0047, 2, 0.28, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(url, gadget.url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "label": "testImageElementFromJson", "type": "function", "loc": [123, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.6233, 0.107, 1, 0.44, 0.8, 640, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testImageElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testImageElementFromJson(self):\n url = 'http://www.foo.com/image.png'\n width = '32'\n height = '32'\n attachment_id = '2'\n caption = 'Test Image'\n json = {\n 'type': element.Image.class_type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L124_C4", "label": "url =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.5767, 0.0047, 2, 0.13, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.foo.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L125_C4", "label": "width =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.5814, 0.0047, 2, 0.13, 0.0833, 989, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = '32'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L126_C4", "label": "height =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.586, 0.0047, 2, 0.13, 0.1667, 751, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height = '32'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L127_C4", "label": "attachment_id =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.5907, 0.0047, 2, 0.13, 0.25, 475, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_id = '2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L128_C4", "label": "caption =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.5953, 0.0047, 2, 0.13, 0.3333, 512, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "caption", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caption = 'Test Image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L129_C4", "label": "json =", "type": "assigned_variable", "loc": [129, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.6209, 0.0465, 2, 0.13, 0.4167, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Image.class_type,\n 'properties': {\n 'url': url,\n 'width': width,\n 'height': height,\n 'attachmentId': attachment_id,\n 'caption': caption,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L139_C4", "label": "image = from_json()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [14, 2, 0.6465, 0.0047, 2, 0.13, 0.5, 505, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " image = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L140_C4", "label": "assertEquals()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6512, 0.0047, 2, 0.13, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Image.class_type, image.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6558, 0.0047, 2, 0.13, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(url, image.url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L142_C4", "label": "assertEquals()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6605, 0.0047, 2, 0.13, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(width, image.width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L143_C4", "label": "assertEquals()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6651, 0.0047, 2, 0.13, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(height, image.height)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L144_C4", "label": "assertEquals()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6698, 0.0047, 2, 0.13, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_id, image.attachmentId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "vector": [8, 2, 0.6744, 0.0047, 2, 0.13, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(caption, image.caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "label": "testAttachmentElementFromJson", "type": "function", "loc": [147, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.7349, 0.107, 1, 0.44, 0.8667, 740, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testAttachmentElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAttachmentElementFromJson(self):\n caption = 'fake caption'\n data = 'fake data'\n mime_type = 'fake mime'\n attachment_id = 'fake id'\n attachment_url = 'fake URL'\n json = {\n 'type': element.Attachment.class_type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L148_C4", "label": "caption =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.6884, 0.0047, 2, 0.85, 0.0, 512, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "caption", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caption = 'fake caption'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L149_C4", "label": "data =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.693, 0.0047, 2, 0.85, 0.0833, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = 'fake data'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L150_C4", "label": "mime_type =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.6977, 0.0047, 2, 0.85, 0.1667, 188, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mime_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mime_type = 'fake mime'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L151_C4", "label": "attachment_id =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.7023, 0.0047, 2, 0.85, 0.25, 475, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_id = 'fake id'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L152_C4", "label": "attachment_url =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.707, 0.0047, 2, 0.85, 0.3333, 32, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_url = 'fake URL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L153_C4", "label": "json =", "type": "assigned_variable", "loc": [153, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.7326, 0.0465, 2, 0.85, 0.4167, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Attachment.class_type,\n 'properties': {\n 'caption': caption,\n 'data': data,\n 'mimeType': mime_type,\n 'attachmentId': attachment_id,\n 'attachmentUrl': attachment_url,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L163_C4", "label": "attachment = from_json()", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [14, 2, 0.7581, 0.0047, 2, 0.85, 0.5, 113, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " attachment = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L164_C4", "label": "assertEquals()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.7628, 0.0047, 2, 0.85, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Attachment.class_type, attachment.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L165_C4", "label": "assertEquals()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.7674, 0.0047, 2, 0.85, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(caption, attachment.caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L166_C4", "label": "assertEquals()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.7721, 0.0047, 2, 0.85, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(data, attachment.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L167_C4", "label": "assertEquals()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.7767, 0.0047, 2, 0.85, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(mime_type, attachment.mimeType)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L168_C4", "label": "assertEquals()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.7814, 0.0047, 2, 0.85, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_id, attachment.attachmentId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L169_C4", "label": "assertEquals()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "vector": [8, 2, 0.786, 0.0047, 2, 0.85, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_url, attachment.attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "label": "testFormElementFromJson", "type": "function", "loc": [171, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.8302, 0.0744, 1, 0.44, 0.9333, 918, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testFormElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFormElementFromJson(self):\n name = 'button'\n value = 'value'\n default_value = 'foo'\n json = {\n 'type': element.Label.class_type,\n 'properties': {\n 'name': name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L172_C4", "label": "name =", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [14, 2, 0.8, 0.0047, 2, 0.15, 0.0, 57, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = 'button'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L173_C4", "label": "value =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [14, 2, 0.8047, 0.0047, 2, 0.15, 0.1429, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L174_C4", "label": "default_value =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [14, 2, 0.8093, 0.0047, 2, 0.15, 0.2857, 876, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_value = 'foo'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L175_C4", "label": "json =", "type": "assigned_variable", "loc": [175, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [14, 2, 0.8302, 0.0372, 2, 0.15, 0.4286, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Label.class_type,\n 'properties': {\n 'name': name,\n 'value': value,\n 'defaultValue': default_value,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L183_C4", "label": "el = from_json()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [14, 2, 0.8512, 0.0047, 2, 0.15, 0.5714, 144, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " el = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L184_C4", "label": "assertEquals()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [8, 2, 0.8558, 0.0047, 2, 0.15, 0.7143, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Label.class_type, el.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L185_C4", "label": "assertEquals()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [8, 2, 0.8605, 0.0047, 2, 0.15, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(name, el.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L186_C4", "label": "assertEquals()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "vector": [8, 2, 0.8651, 0.0047, 2, 0.15, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(value, el.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "label": "testCanInstantiate", "type": "function", "loc": [188, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "vector": [2, 1, 0.9279, 0.1116, 1, 0.44, 1.0, 394, 0, 1, 0, 0, 0, 0, 23], "semantic": {"name": "testCanInstantiate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCanInstantiate(self):\n bag = [element.Check(name='check', value='value'),\n element.Button(name='button', value='caption'),\n element.Input(name='input', value='caption'),\n element.Label(label_for='button', caption='caption'),\n element.RadioButton(name='name', group='group'),\n element.RadioButtonGroup(name='name', value='value'),\n element.Password(name='name', value='geheim'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L189_C4", "label": "bag =", "type": "assigned_variable", "loc": [189, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [14, 2, 0.9163, 0.0791, 2, 0.71, 0.0, 117, 0, 0, 0, 0, 0, 5, 13], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bag = [element.Check(name='check', value='value'),\n element.Button(name='button', value='caption'),\n element.Input(name='input', value='caption'),\n element.Label(label_for='button', caption='caption'),\n element.RadioButton(name='name', group='group'),\n element.RadioButtonGroup(name='name', value='value'),\n element.Password(name='name', value='geheim'),\n element.TextArea(name='name', value='\\n\\n\\n'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L206_C4", "label": "types_constructed = set()", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [14, 2, 0.9581, 0.0047, 2, 0.71, 0.1667, 491, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "types_constructed", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " types_constructed = set([type(x) for x in bag])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L207_C4", "label": "types_required = set()", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [14, 2, 0.9628, 0.0047, 2, 0.71, 0.3333, 312, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "types_required", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " types_required = set(element.ALL.values())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L208_C4", "label": "missing_required = difference()", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [14, 2, 0.9674, 0.0047, 2, 0.71, 0.5, 995, 3, 1, 0, 0, 498, 10, 1], "semantic": {"name": "missing_required", "arg_names": [], "import_names": [], "rhs_call_name": "difference", "annotation": ""}, "snippet": " missing_required = types_constructed.difference(types_required)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L209_C4", "label": "assertEquals()", "type": "expression", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [8, 2, 0.9721, 0.0047, 2, 0.71, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(missing_required, set())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L210_C4", "label": "missing_constructed = difference()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [14, 2, 0.9767, 0.0047, 2, 0.71, 0.8333, 70, 3, 1, 0, 0, 498, 10, 1], "semantic": {"name": "missing_constructed", "arg_names": [], "import_names": [], "rhs_call_name": "difference", "annotation": ""}, "snippet": " missing_constructed = types_required.difference(types_constructed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L211_C4", "label": "assertEquals()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "vector": [8, 2, 0.9814, 0.0047, 2, 0.71, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(missing_constructed, set())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:If_L214_C0", "label": "if", "type": "if", "loc": [214, 215], "level": 0, "parent": null, "vector": [4, 0, 0.9977, 0.0093, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L215_C2", "label": "main()", "type": "expression", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1110:If_L214_C0", "vector": [8, 1, 1.0, 0.0047, 1, 0.41, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1110:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1110:Expr_L215_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the util module."""
__author__ = 'davidbyttow@google.com (David Byttow)'
import unittest
import ops
import util
class TestUtils(unittest.TestCase):
"""Tests utility functions."""
def testIsIterable(self):
self.assertTrue(util.is_iterable([]))
self.assertTrue(util.is_iterable({}))
self.assertTrue(util.is_iterable(set()))
self.assertTrue(util.is_iterable(()))
self.assertFalse(util.is_iterable(42))
self.assertFalse(util.is_iterable('list?'))
self.assertFalse(util.is_iterable(object))
def testIsDict(self):
self.assertFalse(util.is_dict([]))
self.assertTrue(util.is_dict({}))
self.assertFalse(util.is_dict(set()))
self.assertFalse(util.is_dict(()))
self.assertFalse(util.is_dict(42))
self.assertFalse(util.is_dict('dict?'))
self.assertFalse(util.is_dict(object))
def testIsUserDefinedNewStyleClass(self):
class OldClass:
pass
class NewClass(object):
pass
self.assertFalse(util.is_user_defined_new_style_class(OldClass()))
self.assertTrue(util.is_user_defined_new_style_class(NewClass()))
self.assertFalse(util.is_user_defined_new_style_class({}))
self.assertFalse(util.is_user_defined_new_style_class(()))
self.assertFalse(util.is_user_defined_new_style_class(42))
self.assertFalse(util.is_user_defined_new_style_class('instance?'))
def testLowerCamelCase(self):
self.assertEquals('foo', util.lower_camel_case('foo'))
self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))
self.assertEquals('fooBar', util.lower_camel_case('fooBar'))
self.assertEquals('blipId', util.lower_camel_case('blip_id'))
self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))
self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))
self.assertEquals('f', util.lower_camel_case('f'))
self.assertEquals('f', util.lower_camel_case('f_'))
self.assertEquals('', util.lower_camel_case(''))
self.assertEquals('', util.lower_camel_case('_'))
self.assertEquals('aBCDEF', util.lower_camel_case('_a_b_c_d_e_f_'))
def assertListsEqual(self, a, b):
self.assertEquals(len(a), len(b))
for i in range(len(a)):
self.assertEquals(a[i], b[i])
def assertDictsEqual(self, a, b):
self.assertEquals(len(a.keys()), len(b.keys()))
for k, v in a.iteritems():
self.assertEquals(v, b[k])
def testSerializeList(self):
data = [1, 2, 3]
output = util.serialize(data)
self.assertListsEqual(data, output)
def testSerializeDict(self):
data = {'key': 'value', 'under_score': 'value2'}
expected = {'key': 'value', 'underScore': 'value2'}
output = util.serialize(data)
self.assertDictsEqual(expected, output)
def testNonNoneDict(self):
a = {'a': 1, 'b': 1}
self.assertDictsEqual(a, util.non_none_dict(a))
b = a.copy()
b['c'] = None
self.assertDictsEqual(a, util.non_none_dict(b))
def testForceUnicode(self):
self.assertEquals(u"aaa", util.force_unicode("aaa"))
self.assertEquals(u"12", util.force_unicode(12))
self.assertEquals(u"\u0430\u0431\u0432",
util.force_unicode("\xd0\xb0\xd0\xb1\xd0\xb2"))
self.assertEquals(u'\u30e6\u30cb\u30b3\u30fc\u30c9',
util.force_unicode(u'\u30e6\u30cb\u30b3\u30fc\u30c9'))
def testSerializeAttributes(self):
class Data(object):
def __init__(self):
self.public = 1
self._protected = 2
self.__private = 3
def Func(self):
pass
data = Data()
output = util.serialize(data)
# Functions and non-public fields should not be serialized.
self.assertEquals(1, len(output.keys()))
self.assertEquals(data.public, output['public'])
def testStringEnum(self):
util.StringEnum()
single = util.StringEnum('foo')
self.assertEquals('foo', single.foo)
multi = util.StringEnum('foo', 'bar')
self.assertEquals('foo', multi.foo)
self.assertEquals('bar', multi.bar)
def testParseMarkup(self):
self.assertEquals('foo', util.parse_markup('foo'))
self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))
self.assertEquals('foo\nbar', util.parse_markup('foo<br>bar'))
self.assertEquals('foo\nbar', util.parse_markup('foo<p indent="3">bar'))
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1111 | 97 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1172, 0.0069, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the util module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L20_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.1379, 0.0069, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'davidbyttow@google.com (David Byttow)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Import_L23_C0", "label": "unittest import unittest", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1586, 0.0069, 0, 0.66, 0.3333, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Import_L25_C0", "label": "ops import ops", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1724, 0.0069, 0, 0.66, 0.5, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Import_L26_C0", "label": "util import util", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1793, 0.0069, 0, 0.66, 0.6667, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "label": "TestUtils", "type": "class", "loc": [29, 142], "level": 0, "parent": null, "vector": [3, 0, 0.5897, 0.7862, 0, 0.66, 0.8333, 402, 0, 15, 0, 0, 878, 0, 99], "semantic": {"name": "TestUtils", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestUtils(unittest.TestCase):\n \"\"\"Tests utility functions.\"\"\"\n\n def testIsIterable(self):\n self.assertTrue(util.is_iterable([]))\n self.assertTrue(util.is_iterable({}))\n self.assertTrue(util.is_iterable(set()))\n self.assertTrue(util.is_iterable(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L30_C2", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [8, 1, 0.2069, 0.0069, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests utility functions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "label": "testIsIterable", "type": "function", "loc": [32, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.2448, 0.0552, 1, 0.14, 0.0769, 468, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "testIsIterable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsIterable(self):\n self.assertTrue(util.is_iterable([]))\n self.assertTrue(util.is_iterable({}))\n self.assertTrue(util.is_iterable(set()))\n self.assertTrue(util.is_iterable(()))\n self.assertFalse(util.is_iterable(42))\n self.assertFalse(util.is_iterable('list?'))\n self.assertFalse(util.is_iterable(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L33_C4", "label": "assertTrue()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2276, 0.0069, 2, 0.01, 0.0, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable([]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L34_C4", "label": "assertTrue()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2345, 0.0069, 2, 0.01, 0.1667, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L35_C4", "label": "assertTrue()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2414, 0.0069, 2, 0.01, 0.3333, 170, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable(set()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L36_C4", "label": "assertTrue()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2483, 0.0069, 2, 0.01, 0.5, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L37_C4", "label": "assertFalse()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2552, 0.0069, 2, 0.01, 0.6667, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_iterable(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L38_C4", "label": "assertFalse()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.2621, 0.0069, 2, 0.01, 0.8333, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_iterable('list?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L39_C4", "label": "assertFalse()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "vector": [8, 2, 0.269, 0.0069, 2, 0.01, 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(util.is_iterable(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "label": "testIsDict", "type": "function", "loc": [41, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.3069, 0.0552, 1, 0.14, 0.1538, 340, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "testIsDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsDict(self):\n self.assertFalse(util.is_dict([]))\n self.assertTrue(util.is_dict({}))\n self.assertFalse(util.is_dict(set()))\n self.assertFalse(util.is_dict(()))\n self.assertFalse(util.is_dict(42))\n self.assertFalse(util.is_dict('dict?'))\n self.assertFalse(util.is_dict(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L42_C4", "label": "assertFalse()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.2897, 0.0069, 2, 0.38, 0.0, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict([]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L43_C4", "label": "assertTrue()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.2966, 0.0069, 2, 0.38, 0.1667, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_dict({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L44_C4", "label": "assertFalse()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.3034, 0.0069, 2, 0.38, 0.3333, 861, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict(set()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L45_C4", "label": "assertFalse()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.3103, 0.0069, 2, 0.38, 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(util.is_dict(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L46_C4", "label": "assertFalse()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.3172, 0.0069, 2, 0.38, 0.6667, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L47_C4", "label": "assertFalse()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.3241, 0.0069, 2, 0.38, 0.8333, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict('dict?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L48_C4", "label": "assertFalse()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "vector": [8, 2, 0.331, 0.0069, 2, 0.38, 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(util.is_dict(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "label": "testIsUserDefinedNewStyleClass", "type": "function", "loc": [50, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.3862, 0.0897, 1, 0.14, 0.2308, 363, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "testIsUserDefinedNewStyleClass", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsUserDefinedNewStyleClass(self):\n class OldClass:\n pass\n\n class NewClass(object):\n pass\n\n self.assertFalse(util.is_user_defined_new_style_class(OldClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L51_C4", "label": "OldClass", "type": "class", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [3, 2, 0.3552, 0.0138, 2, 0.87, 0.0, 688, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "OldClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class OldClass:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L54_C4", "label": "NewClass", "type": "class", "loc": [54, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [3, 2, 0.3759, 0.0138, 2, 0.87, 0.1429, 65, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "NewClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class NewClass(object):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L57_C4", "label": "assertFalse()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.3931, 0.0069, 2, 0.87, 0.2857, 861, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_user_defined_new_style_class(OldClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L58_C4", "label": "assertTrue()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.4, 0.0069, 2, 0.87, 0.4286, 170, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_user_defined_new_style_class(NewClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L59_C4", "label": "assertFalse()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.4069, 0.0069, 2, 0.87, 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(util.is_user_defined_new_style_class({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L60_C4", "label": "assertFalse()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.4138, 0.0069, 2, 0.87, 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(util.is_user_defined_new_style_class(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L61_C4", "label": "assertFalse()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.4207, 0.0069, 2, 0.87, 0.8571, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_user_defined_new_style_class(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L62_C4", "label": "assertFalse()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "vector": [8, 2, 0.4276, 0.0069, 2, 0.87, 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(util.is_user_defined_new_style_class('instance?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "label": "testLowerCamelCase", "type": "function", "loc": [64, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.4793, 0.0828, 1, 0.14, 0.3077, 436, 0, 1, 0, 0, 0, 0, 22], "semantic": {"name": "testLowerCamelCase", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testLowerCamelCase(self):\n self.assertEquals('foo', util.lower_camel_case('foo'))\n self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))\n self.assertEquals('fooBar', util.lower_camel_case('fooBar'))\n self.assertEquals('blipId', util.lower_camel_case('blip_id'))\n self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))\n self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))\n self.assertEquals('f', util.lower_camel_case('f'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L65_C4", "label": "assertEquals()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4483, 0.0069, 2, 0.3, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', util.lower_camel_case('foo'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L66_C4", "label": "assertEquals()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4552, 0.0069, 2, 0.3, 0.1, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L67_C4", "label": "assertEquals()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4621, 0.0069, 2, 0.3, 0.2, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('fooBar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L68_C4", "label": "assertEquals()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.469, 0.0069, 2, 0.3, 0.3, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('blipId', util.lower_camel_case('blip_id'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L69_C4", "label": "assertEquals()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4759, 0.0069, 2, 0.3, 0.4, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L70_C4", "label": "assertEquals()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4828, 0.0069, 2, 0.3, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4897, 0.0069, 2, 0.3, 0.6, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('f', util.lower_camel_case('f'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.4966, 0.0069, 2, 0.3, 0.7, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('f', util.lower_camel_case('f_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.5034, 0.0069, 2, 0.3, 0.8, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('', util.lower_camel_case(''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.5103, 0.0069, 2, 0.3, 0.9, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('', util.lower_camel_case('_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L75_C4", "label": "assertEquals()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "vector": [8, 2, 0.5172, 0.0069, 2, 0.3, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('aBCDEF', util.lower_camel_case('_a_b_c_d_e_f_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2", "label": "assertListsEqual", "type": "function", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.5414, 0.0276, 1, 0.14, 0.3846, 938, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "assertListsEqual", "arg_names": ["self", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertListsEqual(self, a, b):\n self.assertEquals(len(a), len(b))\n for i in range(len(a)):\n self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2", "vector": [8, 2, 0.5379, 0.0069, 2, 0.32, 0.0, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(a), len(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L79_C4", "label": "for i", "type": "for", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2", "vector": [6, 2, 0.5483, 0.0138, 2, 0.32, 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 range(len(a)):\n self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L80_C6", "label": "assertEquals()", "type": "expression", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L79_C4", "vector": [8, 3, 0.5517, 0.0069, 3, 0.36, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2", "label": "assertDictsEqual", "type": "function", "loc": [82, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.5759, 0.0276, 1, 0.14, 0.4615, 348, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "assertDictsEqual", "arg_names": ["self", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertDictsEqual(self, a, b):\n self.assertEquals(len(a.keys()), len(b.keys()))\n for k, v in a.iteritems():\n self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2", "vector": [8, 2, 0.5724, 0.0069, 2, 0.99, 0.0, 60, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(a.keys()), len(b.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L84_C4", "label": "for k, v", "type": "for", "loc": [84, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2", "vector": [6, 2, 0.5828, 0.0138, 2, 0.99, 1.0, 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 a.iteritems():\n self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L85_C6", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L84_C4", "vector": [8, 3, 0.5862, 0.0069, 3, 0.17, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "label": "testSerializeList", "type": "function", "loc": [87, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.6103, 0.0276, 1, 0.14, 0.5385, 468, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testSerializeList", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeList(self):\n data = [1, 2, 3]\n output = util.serialize(data)\n self.assertListsEqual(data, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L88_C4", "label": "data =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "vector": [14, 2, 0.6069, 0.0069, 2, 0.34, 0.0, 929, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = [1, 2, 3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L89_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "vector": [14, 2, 0.6138, 0.0069, 2, 0.34, 0.5, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L90_C4", "label": "assertListsEqual()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "vector": [8, 2, 0.6207, 0.0069, 2, 0.34, 1.0, 938, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertListsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertListsEqual", "annotation": ""}, "snippet": " self.assertListsEqual(data, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "label": "testSerializeDict", "type": "function", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.6483, 0.0345, 1, 0.14, 0.6154, 33, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testSerializeDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeDict(self):\n data = {'key': 'value', 'under_score': 'value2'}\n expected = {'key': 'value', 'underScore': 'value2'}\n output = util.serialize(data)\n self.assertDictsEqual(expected, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L93_C4", "label": "data =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "vector": [14, 2, 0.6414, 0.0069, 2, 0.23, 0.0, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'key': 'value', 'under_score': 'value2'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L94_C4", "label": "expected =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "vector": [14, 2, 0.6483, 0.0069, 2, 0.23, 0.3333, 361, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = {'key': 'value', 'underScore': 'value2'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L95_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "vector": [14, 2, 0.6552, 0.0069, 2, 0.23, 0.6667, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L96_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "vector": [8, 2, 0.6621, 0.0069, 2, 0.23, 1.0, 348, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(expected, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "label": "testNonNoneDict", "type": "function", "loc": [98, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.6931, 0.0414, 1, 0.14, 0.6923, 881, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testNonNoneDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testNonNoneDict(self):\n a = {'a': 1, 'b': 1}\n self.assertDictsEqual(a, util.non_none_dict(a))\n b = a.copy()\n b['c'] = None\n self.assertDictsEqual(a, util.non_none_dict(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L99_C4", "label": "a =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "vector": [14, 2, 0.6828, 0.0069, 2, 0.49, 0.0, 475, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = {'a': 1, 'b': 1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L100_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "vector": [8, 2, 0.6897, 0.0069, 2, 0.49, 0.25, 348, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(a, util.non_none_dict(a))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L101_C4", "label": "b = copy()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "vector": [14, 2, 0.6966, 0.0069, 2, 0.49, 0.5, 756, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " b = a.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L102_C4", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "vector": [14, 2, 0.7034, 0.0069, 2, 0.49, 0.75, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b['c'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L103_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "vector": [8, 2, 0.7103, 0.0069, 2, 0.49, 1.0, 348, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(a, util.non_none_dict(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "label": "testForceUnicode", "type": "function", "loc": [105, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.7448, 0.0483, 1, 0.14, 0.7692, 4, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testForceUnicode", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testForceUnicode(self):\n self.assertEquals(u\"aaa\", util.force_unicode(\"aaa\"))\n self.assertEquals(u\"12\", util.force_unicode(12))\n self.assertEquals(u\"\\u0430\\u0431\\u0432\",\n util.force_unicode(\"\\xd0\\xb0\\xd0\\xb1\\xd0\\xb2\"))\n self.assertEquals(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9',\n util.force_unicode(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "vector": [8, 2, 0.731, 0.0069, 2, 0.67, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"aaa\", util.force_unicode(\"aaa\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "vector": [8, 2, 0.7379, 0.0069, 2, 0.67, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"12\", util.force_unicode(12))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "vector": [8, 2, 0.7483, 0.0138, 2, 0.67, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"\\u0430\\u0431\\u0432\",\n util.force_unicode(\"\\xd0\\xb0\\xd0\\xb1\\xd0\\xb2\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L110_C4", "label": "assertEquals()", "type": "expression", "loc": [110, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "vector": [8, 2, 0.7621, 0.0138, 2, 0.67, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9',\n util.force_unicode(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "label": "testSerializeAttributes", "type": "function", "loc": [113, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.831, 0.1103, 1, 0.14, 0.8462, 747, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testSerializeAttributes", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeAttributes(self):\n\n class Data(object):\n def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4", "label": "Data", "type": "class", "loc": [115, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "vector": [3, 2, 0.8172, 0.0552, 2, 0.27, 0.0, 467, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Data(object):\n def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3\n\n def Func(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "label": "__init__", "type": "function", "loc": [116, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4", "vector": [2, 3, 0.8103, 0.0276, 3, 0.89, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L117_C8", "label": "self.public =", "type": "assigned_variable", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "vector": [14, 4, 0.8069, 0.0069, 4, 0.2, 0.0, 818, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.public", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.public = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L118_C8", "label": "self._protected =", "type": "assigned_variable", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "vector": [14, 4, 0.8138, 0.0069, 4, 0.2, 0.5, 613, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._protected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._protected = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L119_C8", "label": "self.__private =", "type": "assigned_variable", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "vector": [14, 4, 0.8207, 0.0069, 4, 0.2, 1.0, 90, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.__private", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__private = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L121_C6", "label": "Func", "type": "function", "loc": [121, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4", "vector": [2, 3, 0.8379, 0.0138, 3, 0.89, 1.0, 208, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "Func", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Func(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L124_C4", "label": "data = Data()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "vector": [14, 2, 0.8552, 0.0069, 2, 0.27, 0.25, 929, 3, 0, 0, 0, 467, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "Data", "annotation": ""}, "snippet": " data = Data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L125_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "vector": [14, 2, 0.8621, 0.0069, 2, 0.27, 0.5, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L127_C4", "label": "assertEquals()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "vector": [8, 2, 0.8759, 0.0069, 2, 0.27, 0.75, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(output.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L128_C4", "label": "assertEquals()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "vector": [8, 2, 0.8828, 0.0069, 2, 0.27, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(data.public, output['public'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "label": "testStringEnum", "type": "function", "loc": [130, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.9172, 0.0483, 1, 0.14, 0.9231, 952, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testStringEnum", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testStringEnum(self):\n util.StringEnum()\n single = util.StringEnum('foo')\n self.assertEquals('foo', single.foo)\n multi = util.StringEnum('foo', 'bar')\n self.assertEquals('foo', multi.foo)\n self.assertEquals('bar', multi.bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L131_C4", "label": "StringEnum()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [8, 2, 0.9034, 0.0069, 2, 0.17, 0.0, 716, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "StringEnum", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " util.StringEnum()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L132_C4", "label": "single = StringEnum()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [14, 2, 0.9103, 0.0069, 2, 0.17, 0.2, 311, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "single", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " single = util.StringEnum('foo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L133_C4", "label": "assertEquals()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [8, 2, 0.9172, 0.0069, 2, 0.17, 0.4, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', single.foo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L134_C4", "label": "multi = StringEnum()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [14, 2, 0.9241, 0.0069, 2, 0.17, 0.6, 988, 3, 2, 0, 0, 716, 10, 1], "semantic": {"name": "multi", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " multi = util.StringEnum('foo', 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L135_C4", "label": "assertEquals()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [8, 2, 0.931, 0.0069, 2, 0.17, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', multi.foo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L136_C4", "label": "assertEquals()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "vector": [8, 2, 0.9379, 0.0069, 2, 0.17, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('bar', multi.bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "label": "testParseMarkup", "type": "function", "loc": [138, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "vector": [2, 1, 0.9655, 0.0345, 1, 0.14, 1.0, 78, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testParseMarkup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testParseMarkup(self):\n self.assertEquals('foo', util.parse_markup('foo'))\n self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))\n self.assertEquals('foo\\nbar', util.parse_markup('foo<br>bar'))\n self.assertEquals('foo\\nbar', util.parse_markup('foo<p indent=\"3\">bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L139_C4", "label": "assertEquals()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "vector": [8, 2, 0.9586, 0.0069, 2, 0.37, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', util.parse_markup('foo'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L140_C4", "label": "assertEquals()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "vector": [8, 2, 0.9655, 0.0069, 2, 0.37, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "vector": [8, 2, 0.9724, 0.0069, 2, 0.37, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo\\nbar', util.parse_markup('foo<br>bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L142_C4", "label": "assertEquals()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "vector": [8, 2, 0.9793, 0.0069, 2, 0.37, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo\\nbar', util.parse_markup('foo<p indent=\"3\">bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:If_L144_C0", "label": "if", "type": "if", "loc": [144, 145], "level": 0, "parent": null, "vector": [4, 0, 0.9966, 0.0138, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L145_C2", "label": "main()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1111:If_L144_C0", "vector": [8, 1, 1.0, 0.0069, 1, 0.1, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:For_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L121_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1111:If_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1111:Expr_L145_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import element
import errors
import util
class Annotation(object):
"""Models an annotation on a document.
Annotations are key/value pairs over a range of content. Annotations
can be used to store data or to be interpreted by a client when displaying
the data.
"""
# Use the following constants to control the display of the client
#: Reserved annotation for setting background color of text.
BACKGROUND_COLOR = "style/backgroundColor"
#: Reserved annotation for setting color of text.
COLOR = "style/color"
#: Reserved annotation for setting font family of text.
FONT_FAMILY = "style/fontFamily"
#: Reserved annotation for setting font family of text.
FONT_SIZE = "style/fontSize"
#: Reserved annotation for setting font style of text.
FONT_STYLE = "style/fontStyle"
#: Reserved annotation for setting font weight of text.
FONT_WEIGHT = "style/fontWeight"
#: Reserved annotation for setting text decoration.
TEXT_DECORATION = "style/textDecoration"
#: Reserved annotation for setting vertical alignment.
VERTICAL_ALIGN = "style/verticalAlign"
def __init__(self, name, value, start, end):
self._name = name
self._value = value
self._start = start
self._end = end
@property
def name(self):
return self._name
@property
def value(self):
return self._value
@property
def start(self):
return self._start
@property
def end(self):
return self._end
def _shift(self, where, inc):
"""Shift annotation by 'inc' if it (partly) overlaps with 'where'."""
if self._start >= where:
self._start += inc
if self._end >= where:
self._end += inc
def serialize(self):
"""Serializes the annotation.
Returns:
A dict containing the name, value, and range values.
"""
return {'name': self._name,
'value': self._value,
'range': {'start': self._start,
'end': self._end}}
class Annotations(object):
"""A dictionary-like object containing the annotations, keyed by name."""
def __init__(self, operation_queue, blip):
self._operation_queue = operation_queue
self._blip = blip
self._store = {}
def __contains__(self, what):
if isinstance(what, Annotation):
what = what.name
return what in self._store
def _add_internal(self, name, value, start, end):
"""Internal add annotation does not send out operations."""
if name in self._store:
# TODO: use bisect to make this more efficient.
new_list = []
for existing in self._store[name]:
if start > existing.end or end < existing.start:
new_list.append(existing)
else:
if existing.value == value:
# merge the annotations:
start = min(existing.start, start)
end = max(existing.end, end)
else:
# chop the bits off the existing annotation
if existing.start < start:
new_list.append(Annotation(
existing.name, existing.value, existing.start, start))
if existing.end > end:
new_list.append(Annotation(
existing.name, existing.value, existing.end, end))
new_list.append(Annotation(name, value, start, end))
self._store[name] = new_list
else:
self._store[name] = [Annotation(name, value, start, end)]
def _delete_internal(self, name, start=0, end=-1):
"""Remove the passed annotaion from the internal representation."""
if not name in self._store:
return
if end < 0:
end = len(self._blip) + end
new_list = []
for a in self._store[name]:
if start > a.end or end < a.start:
new_list.append(a)
elif start < a.start and end > a.end:
continue
else:
if a.start < start:
new_list.append(Annotation(name, a.value, a.start, start))
if a.end > end:
new_list.append(Annotation(name, a.value, end, a.end))
if new_list:
self._store[name] = new_list
else:
del self._store[name]
def _shift(self, where, inc):
"""Shift annotation by 'inc' if it (partly) overlaps with 'where'."""
for annotations in self._store.values():
for annotation in annotations:
annotation._shift(where, inc)
# Merge fragmented annotations that should be contiguous, for example:
# Annotation('foo', 'bar', 1, 2) and Annotation('foo', 'bar', 2, 3).
for name, annotations in self._store.items():
new_list = []
for i, annotation in enumerate(annotations):
name = annotation.name
value = annotation.value
start = annotation.start
end = annotation.end
# Find the last end index.
for j, next_annotation in enumerate(annotations[i + 1:]):
# Not contiguous, skip.
if (end < next_annotation.start):
break
# Contiguous, merge.
if (end == next_annotation.start and value == next_annotation.value):
end = next_annotation.end
del annotations[j]
new_list.append(Annotation(name, value, start, end))
self._store[name] = new_list
def __len__(self):
return len(self._store)
def __getitem__(self, key):
return self._store[key]
def __iter__(self):
for l in self._store.values():
for ann in l:
yield ann
def names(self):
"""Return the names of the annotations in the store."""
return self._store.keys()
def serialize(self):
"""Return a list of the serialized annotations."""
res = []
for v in self._store.values():
res += [a.serialize() for a in v]
return res
class Blips(object):
"""A dictionary-like object containing the blips, keyed on blip ID."""
def __init__(self, blips):
self._blips = blips
def __getitem__(self, blip_id):
return self._blips[blip_id]
def __iter__(self):
return self._blips.__iter__()
def __len__(self):
return len(self._blips)
def _add(self, ablip):
self._blips[ablip.blip_id] = ablip
def _remove_with_id(self, blip_id):
del_blip = self._blips[blip_id]
if del_blip:
# Remove the reference to this blip from its parent.
parent_blip = self._blips[blip_id].parent_blip
if parent_blip:
parent_blip._child_blip_ids.remove(blip_id)
del self._blips[blip_id]
def get(self, blip_id, default_value=None):
"""Retrieves a blip.
Returns:
A Blip object. If none found for the ID, it returns None,
or if default_value is specified, it returns that.
"""
return self._blips.get(blip_id, default_value)
def serialize(self):
"""Serializes the blips.
Returns:
A dict of serialized blips.
"""
res = {}
for blip_id, item in self._blips.items():
res[blip_id] = item.serialize()
return res
class BlipRefs(object):
"""Represents a set of references to contents in a blip.
For example, a BlipRefs instance can represent the results
of a search, an explicitly set range, a regular expression,
or refer to the entire blip. BlipRefs are used to express
operations on a blip in a consistent way that can easily
be transfered to the server.
The typical way of creating a BlipRefs object is to use
selector methods on the Blip object. Developers will not
usually instantiate a BlipRefs object directly.
"""
DELETE = 'DELETE'
REPLACE = 'REPLACE'
INSERT = 'INSERT'
INSERT_AFTER = 'INSERT_AFTER'
ANNOTATE = 'ANNOTATE'
CLEAR_ANNOTATION = 'CLEAR_ANNOTATION'
UPDATE_ELEMENT = 'UPDATE_ELEMENT'
def __init__(self, blip, maxres=1):
self._blip = blip
self._maxres = maxres
@classmethod
def all(cls, blip, findwhat, maxres=-1, **restrictions):
"""Construct an instance representing the search for text or elements."""
obj = cls(blip, maxres)
obj._findwhat = findwhat
obj._restrictions = restrictions
obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)
if findwhat is None:
# No findWhat, take the entire blip
obj._params = {}
else:
query = {'maxRes': maxres}
if isinstance(findwhat, basestring):
query['textMatch'] = findwhat
else:
query['elementMatch'] = findwhat.class_type
query['restrictions'] = restrictions
obj._params = {'modifyQuery': query}
return obj
@classmethod
def range(cls, blip, begin, end):
"""Constructs an instance representing an explicitly set range."""
obj = cls(blip)
obj._begin = begin
obj._end = end
obj._hits = lambda: [(begin, end)]
obj._params = {'range': {'start': begin, 'end': end}}
return obj
def _elem_matches(self, elem, clz, **restrictions):
if not isinstance(elem, clz):
return False
for key, val in restrictions.items():
if getattr(elem, key) != val:
return False
return True
def _find(self, what, maxres=-1, **restrictions):
"""Iterates where 'what' occurs in the associated blip.
What can be either a string or a class reference.
Examples:
self._find('hello') will return the first occurence of the word hello
self._find(element.Gadget, url='http://example.com/gadget.xml')
will return the first gadget that has as url example.com.
Args:
what: what to search for. Can be a class or a string. The class
should be an element from element.py
maxres: number of results to return at most, or <= 0 for all.
restrictions: if what specifies a class, further restrictions
of the found instances.
Yields:
Tuples indicating the range of the matches. For a one
character/element match at position x, (x, x+1) is yielded.
"""
blip = self._blip
if what is None:
yield 0, len(blip)
raise StopIteration
if isinstance(what, basestring):
idx = blip._content.find(what)
count = 0
while idx != -1:
yield idx, idx + len(what)
count += 1
if count == maxres:
raise StopIteration
idx = blip._content.find(what, idx + len(what))
else:
count = 0
for idx, el in blip._elements.items():
if self._elem_matches(el, what, **restrictions):
yield idx, idx + 1
count += 1
if count == maxres:
raise StopIteration
def _execute(self, modify_how, what, bundled_annotations=None):
"""Executes this BlipRefs object.
Args:
modify_how: What to do. Any of the operation declared at the top.
what: Depending on the operation. For delete, has to be None.
For the others it is a singleton, a list or a function returning
what to do; for ANNOTATE tuples of (key, value), for the others
either string or elements.
If what is a function, it takes three parameters, the content of
the blip, the beginning of the matching range and the end.
bundled_annotations: Annotations to apply immediately.
Raises:
IndexError when trying to access content outside of the blip.
ValueError when called with the wrong values.
Returns:
self for chainability.
"""
blip = self._blip
if modify_how != BlipRefs.DELETE:
if type(what) != list:
what = [what]
next_index = 0
matched = []
# updated_elements is used to store the element type of the
# element to update
updated_elements = []
# For now, if we find one markup, we'll use it everywhere.
next = None
hit_found = False
for start, end in self._hits():
hit_found = True
if start < 0:
start += len(blip)
if end == 0:
end += len(blip)
if end < 0:
end += len(blip)
if len(blip) == 0:
if start != 0 or end != 0:
raise IndexError('Start and end have to be 0 for empty document')
elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):
raise IndexError('Position outside the document')
if modify_how == BlipRefs.DELETE:
for i in range(start, end):
if i in blip._elements:
del blip._elements[i]
blip._delete_annotations(start, end)
blip._shift(end, start - end)
blip._content = blip._content[:start] + blip._content[end:]
else:
if callable(what):
next = what(blip._content, start, end)
matched.append(next)
else:
next = what[next_index]
next_index = (next_index + 1) % len(what)
if isinstance(next, str):
next = util.force_unicode(next)
if modify_how == BlipRefs.ANNOTATE:
key, value = next
blip.annotations._add_internal(key, value, start, end)
elif modify_how == BlipRefs.CLEAR_ANNOTATION:
blip.annotations._delete_internal(next, start, end)
elif modify_how == BlipRefs.UPDATE_ELEMENT:
el = blip._elements.get(start)
if not element:
raise ValueError('No element found at index %s' % start)
# the passing around of types this way feels a bit dirty:
updated_elements.append(element.Element.from_json({'type': el.type,
'properties': next}))
for k, b in next.items():
setattr(el, k, b)
else:
if modify_how == BlipRefs.INSERT:
end = start
elif modify_how == BlipRefs.INSERT_AFTER:
start = end
elif modify_how == BlipRefs.REPLACE:
pass
else:
raise ValueError('Unexpected modify_how: ' + modify_how)
if isinstance(next, element.Element):
text = ' '
else:
text = next
# in the case of a replace, and the replacement text is shorter,
# delete the delta.
if start != end and len(text) < end - start:
blip._delete_annotations(start + len(text), end)
blip._shift(end, len(text) + start - end)
blip._content = blip._content[:start] + text + blip._content[end:]
if bundled_annotations:
end_annotation = start + len(text)
blip._delete_annotations(start, end_annotation)
for key, value in bundled_annotations:
blip.annotations._add_internal(key, value, start, end_annotation)
if isinstance(next, element.Element):
blip._elements[start] = next
# No match found, return immediately without generating op.
if not hit_found:
return
operation = blip._operation_queue.document_modify(blip.wave_id,
blip.wavelet_id,
blip.blip_id)
for param, value in self._params.items():
operation.set_param(param, value)
modify_action = {'modifyHow': modify_how}
if modify_how == BlipRefs.DELETE:
pass
elif modify_how == BlipRefs.UPDATE_ELEMENT:
modify_action['elements'] = updated_elements
elif (modify_how == BlipRefs.REPLACE or
modify_how == BlipRefs.INSERT or
modify_how == BlipRefs.INSERT_AFTER):
if callable(what):
what = matched
if what:
if not isinstance(next, element.Element):
modify_action['values'] = [util.force_unicode(value) for value in what]
else:
modify_action['elements'] = what
elif modify_how == BlipRefs.ANNOTATE:
modify_action['values'] = [x[1] for x in what]
modify_action['annotationKey'] = what[0][0]
elif modify_how == BlipRefs.CLEAR_ANNOTATION:
modify_action['annotationKey'] = what[0]
if bundled_annotations:
modify_action['bundledAnnotations'] = [
{'key': key, 'value': value} for key, value in bundled_annotations]
operation.set_param('modifyAction', modify_action)
return self
def insert(self, what, bundled_annotations=None):
"""Inserts what at the matched positions."""
return self._execute(
BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)
def insert_after(self, what, bundled_annotations=None):
"""Inserts what just after the matched positions."""
return self._execute(
BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)
def replace(self, what, bundled_annotations=None):
"""Replaces the matched positions with what."""
return self._execute(
BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)
def delete(self):
"""Deletes the content at the matched positions."""
return self._execute(BlipRefs.DELETE, None)
def annotate(self, name, value=None):
"""Annotates the content at the matched positions.
You can either specify both name and value to set the
same annotation, or supply as the first parameter something
that yields name/value pairs. The name and value should both be strings.
"""
if value is None:
what = name
else:
what = (name, value)
return self._execute(BlipRefs.ANNOTATE, what)
def clear_annotation(self, name):
"""Clears the annotation at the matched positions."""
return self._execute(BlipRefs.CLEAR_ANNOTATION, name)
def update_element(self, new_values):
"""Update an existing element with a set of new values."""
return self._execute(BlipRefs.UPDATE_ELEMENT, new_values)
def __nonzero__(self):
"""Return whether we have a value."""
for start, end in self._hits():
return True
return False
def value(self):
"""Convenience method to convert a BlipRefs to value of its first match."""
for start, end in self._hits():
if end - start == 1 and start in self._blip._elements:
return self._blip._elements[start]
else:
return self._blip.text[start:end]
raise ValueError('BlipRefs has no values')
def __getattr__(self, attribute):
"""Mirror the getattr of value().
This allows for clever things like
first(IMAGE).url
or
blip.annotate_with(key, value).upper()
"""
return getattr(self.value(), attribute)
def __radd__(self, other):
"""Make it possible to add this to a string."""
return other + self.value()
def __cmp__(self, other):
"""Support comparision with target."""
return cmp(self.value(), other)
def __iter__(self):
for start_end in self._hits():
yield start_end
class Blip(object):
"""Models a single blip instance.
Blips are essentially the documents that make up a conversation. Blips can
live in a hierarchy of blips. A root blip has no parent blip id, but all
blips have the ids of the wave and wavelet that they are associated with.
Blips also contain annotations, content and elements, which are accessed via
the Document object.
"""
def __init__(self, json, other_blips, operation_queue):
"""Inits this blip with JSON data.
Args:
json: JSON data dictionary from Wave server.
other_blips: A dictionary like object that can be used to resolve
ids of blips to blips.
operation_queue: an OperationQueue object to store generated operations
in.
"""
self._blip_id = json.get('blipId')
self._operation_queue = operation_queue
self._child_blip_ids = set(json.get('childBlipIds', []))
self._content = json.get('content', '')
self._contributors = set(json.get('contributors', []))
self._creator = json.get('creator')
self._last_modified_time = json.get('lastModifiedTime', 0)
self._version = json.get('version', 0)
self._parent_blip_id = json.get('parentBlipId')
self._wave_id = json.get('waveId')
self._wavelet_id = json.get('waveletId')
if isinstance(other_blips, Blips):
self._other_blips = other_blips
else:
self._other_blips = Blips(other_blips)
self._annotations = Annotations(operation_queue, self)
for annjson in json.get('annotations', []):
r = annjson['range']
self._annotations._add_internal(annjson['name'],
annjson['value'],
r['start'],
r['end'])
self._elements = {}
json_elements = json.get('elements', {})
for elem in json_elements:
self._elements[int(elem)] = element.Element.from_json(json_elements[elem])
self.raw_data = json
@property
def blip_id(self):
"""The id of this blip."""
return self._blip_id
@property
def wave_id(self):
"""The id of the wave that this blip belongs to."""
return self._wave_id
@property
def wavelet_id(self):
"""The id of the wavelet that this blip belongs to."""
return self._wavelet_id
@property
def child_blip_ids(self):
"""The set of the ids of this blip's children."""
return self._child_blip_ids
@property
def child_blips(self):
"""The set of blips that are children of this blip."""
return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids
if blid_id in self._other_blips])
@property
def contributors(self):
"""The set of participant ids that contributed to this blip."""
return self._contributors
@property
def creator(self):
"""The id of the participant that created this blip."""
return self._creator
@property
def last_modified_time(self):
"""The time in seconds since epoch when this blip was last modified."""
return self._last_modified_time
@property
def version(self):
"""The version of this blip."""
return self._version
@property
def parent_blip_id(self):
"""The parent blip_id or None if this is the root blip."""
return self._parent_blip_id
@property
def parent_blip(self):
"""The parent blip or None if it is the root."""
# if parent_blip_id is None, get will also return None
return self._other_blips.get(self._parent_blip_id)
@property
def inline_blip_offset(self):
"""The offset in the parent if this blip is inline or -1 if not.
If the parent is not in the context, this function will always
return -1 since it can't determine the inline blip status.
"""
parent = self.parent_blip
if not parent:
return -1
for offset, el in parent._elements.items():
if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:
return offset
return -1
def is_root(self):
"""Returns whether this is the root blip of a wavelet."""
return self._parent_blip_id is None
@property
def annotations(self):
"""The annotations for this document."""
return self._annotations
@property
def elements(self):
"""Returns a list of elements for this document.
The elements of a blip are things like forms elements and gadgets
that cannot be expressed as plain text. In the text of the blip, you'll
typically find a space as a place holder for the element.
If you want to retrieve the element at a particular index in the blip, use
blip[index].value().
"""
return self._elements.values()
def __len__(self):
return len(self._content)
def __getitem__(self, item):
"""returns a BlipRefs for the given slice."""
if isinstance(item, slice):
if item.step:
raise errors.Error('Step not supported for blip slices')
return self.range(item.start, item.stop)
else:
return self.at(item)
def __setitem__(self, item, value):
"""short cut for self.range/at().replace(value)."""
self.__getitem__(item).replace(value)
def __delitem__(self, item):
"""short cut for self.range/at().delete()."""
self.__getitem__(item).delete()
def _shift(self, where, inc):
"""Move element and annotations after 'where' up by 'inc'."""
new_elements = {}
for idx, el in self._elements.items():
if idx >= where:
idx += inc
new_elements[idx] = el
self._elements = new_elements
self._annotations._shift(where, inc)
def _delete_annotations(self, start, end):
"""Delete all annotations between 'start' and 'end'."""
for annotation_name in self._annotations.names():
self._annotations._delete_internal(annotation_name, start, end)
def all(self, findwhat=None, maxres=-1, **restrictions):
"""Returns a BlipRefs object representing all results for the search.
If searching for an element, the restrictions can be used to specify
additional element properties to filter on, like the url of a Gadget.
"""
return BlipRefs.all(self, findwhat, maxres, **restrictions)
def first(self, findwhat=None, **restrictions):
"""Returns a BlipRefs object representing the first result for the search.
If searching for an element, the restrictions can be used to specify
additional element properties to filter on, like the url of a Gadget.
"""
return BlipRefs.all(self, findwhat, 1, **restrictions)
def at(self, index):
"""Returns a BlipRefs object representing a 1-character range."""
return BlipRefs.range(self, index, index + 1)
def range(self, start, end):
"""Returns a BlipRefs object representing the range."""
return BlipRefs.range(self, start, end)
def serialize(self):
"""Return a dictionary representation of this blip ready for json."""
return {'blipId': self._blip_id,
'childBlipIds': list(self._child_blip_ids),
'content': self._content,
'creator': self._creator,
'contributors': list(self._contributors),
'lastModifiedTime': self._last_modified_time,
'version': self._version,
'parentBlipId': self._parent_blip_id,
'waveId': self._wave_id,
'waveletId': self._wavelet_id,
'annotations': self._annotations.serialize(),
'elements': dict([(index, e.serialize())
for index, e in self._elements.items()])
}
def proxy_for(self, proxy_for_id):
"""Return a view on this blip that will proxy for the specified id.
A shallow copy of the current blip is returned with the proxy_for_id
set. Any modifications made to this copy will be done using the
proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will
be used.
"""
operation_queue = self._operation_queue.proxy_for(proxy_for_id)
res = Blip(json={},
other_blips={},
operation_queue=operation_queue)
res._blip_id = self._blip_id
res._child_blip_ids = self._child_blip_ids
res._content = self._content
res._contributors = self._contributors
res._creator = self._creator
res._last_modified_time = self._last_modified_time
res._version = self._version
res._parent_blip_id = self._parent_blip_id
res._wave_id = self._wave_id
res._wavelet_id = self._wavelet_id
res._other_blips = self._other_blips
res._annotations = self._annotations
res._elements = self._elements
res.raw_data = self.raw_data
return res
@property
def text(self):
"""Returns the raw text content of this document."""
return self._content
def find(self, what, **restrictions):
"""Iterate to matching bits of contents.
Yield either elements or pieces of text.
"""
br = BlipRefs.all(self, what, **restrictions)
for start, end in br._hits():
if end - start == 1 and start in self._elements:
yield self._elements[start]
else:
yield self._content[start:end]
raise StopIteration
def append(self, what, bundled_annotations=None):
"""Convenience method covering a common pattern."""
return BlipRefs.all(self, findwhat=None).insert_after(
what, bundled_annotations=bundled_annotations)
def reply(self):
"""Create and return a reply to this blip."""
blip_data = self._operation_queue.blip_create_child(self.wave_id,
self.wavelet_id,
self.blip_id)
new_blip = Blip(blip_data, self._other_blips, self._operation_queue)
self._other_blips._add(new_blip)
return new_blip
def append_markup(self, markup):
"""Interpret the markup text as xhtml and append the result to the doc.
Args:
markup: The markup'ed text to append.
"""
markup = util.force_unicode(markup)
self._operation_queue.document_append_markup(self.wave_id,
self.wavelet_id,
self.blip_id,
markup)
self._content += util.parse_markup(markup)
def insert_inline_blip(self, position):
"""Inserts an inline blip into this blip at a specific position.
Args:
position: Position to insert the blip at. This has to be greater than 0.
Returns:
The JSON data of the blip that was created.
"""
if position <= 0:
raise IndexError(('Illegal inline blip position: %d. Position has to ' +
'be greater than 0.') % position)
blip_data = self._operation_queue.document_inline_blip_insert(
self.wave_id,
self.wavelet_id,
self.blip_id,
position)
new_blip = Blip(blip_data, self._other_blips, self._operation_queue)
self._other_blips._add(new_blip)
return new_blip
| ajibawa-2023/Python-Code-Large/train/row_1112 | 499 | 889 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Import_L17_C0", "label": "element import element", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0191, 0.0011, 0, 0.66, 0.0, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Import_L18_C0", "label": "errors import errors", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0202, 0.0011, 0, 0.66, 0.1429, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Import_L20_C0", "label": "util import util", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0225, 0.0011, 0, 0.66, 0.2857, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "label": "Annotation", "type": "class", "loc": [22, 87], "level": 0, "parent": null, "vector": [3, 0, 0.0613, 0.0742, 0, 0.66, 0.4286, 568, 0, 7, 0, 0, 186, 0, 0], "semantic": {"name": "Annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Annotation(object):\n \"\"\"Models an annotation on a document.\n\n Annotations are key/value pairs over a range of content. Annotations\n can be used to store data or to be interpreted by a client when displaying\n the data.\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [8, 1, 0.0287, 0.0067, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models an annotation on a document.\n\n Annotations are key/value pairs over a range of content. Annotations\n can be used to store data or to be interpreted by a client when displaying\n the data.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L33_C2", "label": "BACKGROUND_COLOR =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0371, 0.0011, 1, 0.64, 0.0667, 856, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BACKGROUND_COLOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BACKGROUND_COLOR = \"style/backgroundColor\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L35_C2", "label": "COLOR =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0394, 0.0011, 1, 0.64, 0.1333, 369, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COLOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " COLOR = \"style/color\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L37_C2", "label": "FONT_FAMILY =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0416, 0.0011, 1, 0.64, 0.2, 868, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_FAMILY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_FAMILY = \"style/fontFamily\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L39_C2", "label": "FONT_SIZE =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0439, 0.0011, 1, 0.64, 0.2667, 254, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_SIZE = \"style/fontSize\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L41_C2", "label": "FONT_STYLE =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0461, 0.0011, 1, 0.64, 0.3333, 887, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_STYLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_STYLE = \"style/fontStyle\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L43_C2", "label": "FONT_WEIGHT =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0484, 0.0011, 1, 0.64, 0.4, 333, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_WEIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_WEIGHT = \"style/fontWeight\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L45_C2", "label": "TEXT_DECORATION =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0506, 0.0011, 1, 0.64, 0.4667, 618, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEXT_DECORATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TEXT_DECORATION = \"style/textDecoration\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L47_C2", "label": "VERTICAL_ALIGN =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [14, 1, 0.0529, 0.0011, 1, 0.64, 0.5333, 472, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERTICAL_ALIGN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " VERTICAL_ALIGN = \"style/verticalAlign\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "label": "__init__", "type": "function", "loc": [49, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0574, 0.0056, 1, 0.64, 0.6, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value, start, end):\n self._name = name\n self._value = value\n self._start = start\n self._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L50_C4", "label": "self._name =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "vector": [14, 2, 0.0562, 0.0011, 2, 0.17, 0.0, 257, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L51_C4", "label": "self._value =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "vector": [14, 2, 0.0574, 0.0011, 2, 0.17, 0.3333, 756, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L52_C4", "label": "self._start =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "vector": [14, 2, 0.0585, 0.0011, 2, 0.17, 0.6667, 403, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._start = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L53_C4", "label": "self._end =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "vector": [14, 2, 0.0596, 0.0011, 2, 0.17, 1.0, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L56_C2", "label": "name", "type": "function", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0636, 0.0022, 1, 0.64, 0.6667, 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 return self._name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L56_C2", "vector": [13, 2, 0.0641, 0.0011, 2, 0.41, 0.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_1112:FunctionDef_L60_C2", "label": "value", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0681, 0.0022, 1, 0.64, 0.7333, 441, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n return self._value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L60_C2", "vector": [13, 2, 0.0686, 0.0011, 2, 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._value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L64_C2", "label": "start", "type": "function", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0726, 0.0022, 1, 0.64, 0.8, 511, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n return self._start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L64_C2", "vector": [13, 2, 0.0731, 0.0011, 2, 0.04, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L68_C2", "label": "end", "type": "function", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0771, 0.0022, 1, 0.64, 0.8667, 128, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def end(self):\n return self._end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L69_C4", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L68_C2", "vector": [13, 2, 0.0776, 0.0011, 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._end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "label": "_shift", "type": "function", "loc": [71, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0827, 0.0067, 1, 0.64, 0.9333, 613, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\"\n if self._start >= where:\n self._start += inc\n if self._end >= where:\n self._end += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L72_C4", "label": "expression", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "vector": [8, 2, 0.081, 0.0011, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L73_C4", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "vector": [4, 2, 0.0827, 0.0022, 2, 0.49, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._start >= where:\n self._start += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L75_C4", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "vector": [4, 2, 0.0849, 0.0022, 2, 0.49, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._end >= where:\n self._end += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2", "label": "serialize", "type": "function", "loc": [78, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "vector": [2, 1, 0.0928, 0.0112, 1, 0.64, 1.0, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the annotation.\n\n Returns:\n A dict containing the name, value, and range values.\n \"\"\"\n return {'name': self._name,\n 'value': self._value,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2", "vector": [8, 2, 0.0911, 0.0056, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the annotation.\n\n Returns:\n A dict containing the name, value, and range values.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2", "vector": [13, 2, 0.0962, 0.0045, 2, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'name': self._name,\n 'value': self._value,\n 'range': {'start': self._start,\n 'end': self._end}}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "label": "Annotations", "type": "class", "loc": [90, 201], "level": 0, "parent": null, "vector": [3, 0, 0.1637, 0.126, 0, 0.66, 0.5714, 781, 0, 10, 0, 0, 186, 0, 29], "semantic": {"name": "Annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Annotations(object):\n \"\"\"A dictionary-like object containing the annotations, keyed by name.\"\"\"\n\n def __init__(self, operation_queue, blip):\n self._operation_queue = operation_queue\n self._blip = blip\n self._store = {}\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L91_C2", "label": "expression", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [8, 1, 0.1024, 0.0011, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A dictionary-like object containing the annotations, keyed by name.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "label": "__init__", "type": "function", "loc": [93, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.1063, 0.0045, 1, 0.48, 0.1, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "operation_queue", "blip"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, operation_queue, blip):\n self._operation_queue = operation_queue\n self._blip = blip\n self._store = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L94_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "vector": [14, 2, 0.1057, 0.0011, 2, 0.92, 0.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L95_C4", "label": "self._blip =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "vector": [14, 2, 0.1069, 0.0011, 2, 0.92, 0.5, 818, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blip = blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L96_C4", "label": "self._store =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "vector": [14, 2, 0.108, 0.0011, 2, 0.92, 1.0, 191, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2", "label": "__contains__", "type": "function", "loc": [98, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.1119, 0.0045, 1, 0.48, 0.2, 456, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__contains__", "arg_names": ["self", "what"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, what):\n if isinstance(what, Annotation):\n what = what.name\n return what in self._store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L99_C4", "label": "if", "type": "if", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2", "vector": [4, 2, 0.1119, 0.0022, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(what, Annotation):\n what = what.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L100_C6", "label": "what =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L99_C4", "vector": [14, 3, 0.1125, 0.0011, 3, 0.68, 0.0, 63, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = what.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2", "vector": [13, 2, 0.1136, 0.0011, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return what in self._store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2", "label": "_add_internal", "type": "function", "loc": [103, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.1294, 0.0281, 1, 0.48, 0.3, 508, 0, 5, 0, 0, 0, 0, 10], "semantic": {"name": "_add_internal", "arg_names": ["self", "name", "value", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _add_internal(self, name, value, start, end):\n \"\"\"Internal add annotation does not send out operations.\"\"\"\n if name in self._store:\n # TODO: use bisect to make this more efficient.\n new_list = []\n for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2", "vector": [8, 2, 0.117, 0.0011, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Internal add annotation does not send out operations.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "label": "if", "type": "if", "loc": [105, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2", "vector": [4, 2, 0.1305, 0.0259, 2, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self._store:\n # TODO: use bisect to make this more efficient.\n new_list = []\n for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L107_C6", "label": "new_list =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "vector": [14, 3, 0.1204, 0.0011, 3, 0.26, 0.0, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L108_C6", "label": "for existing", "type": "for", "loc": [108, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "vector": [6, 3, 0.1299, 0.018, 3, 0.26, 0.25, 586, 6, 0, 0, 0, 0, 0, 7], "semantic": {"name": "existing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8", "label": "if", "type": "if", "loc": [109, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L108_C6", "vector": [4, 4, 0.1305, 0.0169, 4, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L110_C10", "label": "append()", "type": "expression", "loc": [110, 110], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8", "vector": [8, 5, 0.1237, 0.0011, 5, 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": " new_list.append(existing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "label": "if", "type": "if", "loc": [112, 123], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8", "vector": [4, 5, 0.1322, 0.0135, 5, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)\n else:\n # chop the bits off the existing annotation\n if existing.start < start:\n new_list.append(Annotation("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L114_C12", "label": "start = min()", "type": "assigned_variable", "loc": [114, 114], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "vector": [14, 6, 0.1282, 0.0011, 6, 0.41, 0.0, 511, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " start = min(existing.start, start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L115_C12", "label": "end = max()", "type": "assigned_variable", "loc": [115, 115], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "vector": [14, 6, 0.1294, 0.0011, 6, 0.41, 0.3333, 128, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " end = max(existing.end, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L118_C12", "label": "if", "type": "if", "loc": [118, 120], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "vector": [4, 6, 0.1339, 0.0034, 6, 0.41, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.start < start:\n new_list.append(Annotation(\n existing.name, existing.value, existing.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L119_C14", "label": "append()", "type": "expression", "loc": [119, 120], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L118_C12", "vector": [8, 7, 0.1344, 0.0022, 7, 0.34, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(\n existing.name, existing.value, existing.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L121_C12", "label": "if", "type": "if", "loc": [121, 123], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "vector": [4, 6, 0.1372, 0.0034, 6, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.end > end:\n new_list.append(Annotation(\n existing.name, existing.value, existing.end, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L122_C14", "label": "append()", "type": "expression", "loc": [122, 123], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L121_C12", "vector": [8, 7, 0.1378, 0.0022, 7, 0.83, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(\n existing.name, existing.value, existing.end, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L124_C6", "label": "append()", "type": "expression", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "vector": [8, 3, 0.1395, 0.0011, 3, 0.26, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, value, start, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L125_C6", "label": "assign", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "vector": [14, 3, 0.1406, 0.0011, 3, 0.26, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L127_C6", "label": "assign", "type": "assigned_variable", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "vector": [14, 3, 0.1429, 0.0011, 3, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = [Annotation(name, value, start, end)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "label": "_delete_internal", "type": "function", "loc": [129, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.1569, 0.0247, 1, 0.48, 0.4, 221, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "_delete_internal", "arg_names": ["self", "name", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_internal(self, name, start=0, end=-1):\n \"\"\"Remove the passed annotaion from the internal representation.\"\"\"\n if not name in self._store:\n return\n if end < 0:\n end = len(self._blip) + end\n\n new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L130_C4", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [8, 2, 0.1462, 0.0011, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Remove the passed annotaion from the internal representation.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L131_C4", "label": "if", "type": "if", "loc": [131, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [4, 2, 0.1479, 0.0022, 2, 0.15, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name in self._store:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L132_C6", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L131_C4", "vector": [13, 3, 0.1485, 0.0011, 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"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L133_C4", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [4, 2, 0.1502, 0.0022, 2, 0.15, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end < 0:\n end = len(self._blip) + end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L134_C6", "label": "end =", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L133_C4", "vector": [14, 3, 0.1507, 0.0011, 3, 0.68, 0.0, 128, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = len(self._blip) + end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L136_C4", "label": "new_list =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [14, 2, 0.153, 0.0011, 2, 0.15, 0.6, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L137_C4", "label": "for a", "type": "for", "loc": [137, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [6, 2, 0.1592, 0.0112, 2, 0.15, 0.8, 475, 6, 0, 0, 0, 0, 0, 5], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for a in self._store[name]:\n if start > a.end or end < a.start:\n new_list.append(a)\n elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6", "label": "if", "type": "if", "loc": [138, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L137_C4", "vector": [4, 3, 0.1597, 0.0101, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start > a.end or end < a.start:\n new_list.append(a)\n elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))\n if a.end > end:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L139_C8", "label": "append()", "type": "expression", "loc": [139, 139], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6", "vector": [8, 4, 0.1564, 0.0011, 4, 0.64, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6", "label": "if", "type": "if", "loc": [140, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6", "vector": [4, 4, 0.1609, 0.0079, 4, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))\n if a.end > end:\n new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L143_C8", "label": "if", "type": "if", "loc": [143, 144], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6", "vector": [4, 5, 0.1614, 0.0022, 5, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L144_C10", "label": "append()", "type": "expression", "loc": [144, 144], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L143_C8", "vector": [8, 6, 0.162, 0.0011, 6, 0.12, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L145_C8", "label": "if", "type": "if", "loc": [145, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6", "vector": [4, 5, 0.1637, 0.0022, 5, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.end > end:\n new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L146_C10", "label": "append()", "type": "expression", "loc": [146, 146], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L145_C8", "vector": [8, 6, 0.1642, 0.0011, 6, 0.24, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L147_C4", "label": "if", "type": "if", "loc": [147, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "vector": [4, 2, 0.167, 0.0045, 2, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_list:\n self._store[name] = new_list\n else:\n del self._store[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L148_C6", "label": "assign", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L147_C4", "vector": [14, 3, 0.1665, 0.0011, 3, 0.74, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "label": "_shift", "type": "function", "loc": [152, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.1862, 0.0315, 1, 0.48, 0.5, 613, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\"\n for annotations in self._store.values():\n for annotation in annotations:\n annotation._shift(where, inc)\n\n # Merge fragmented annotations that should be contiguous, for example:\n # Annotation('foo', 'bar', 1, 2) and Annotation('foo', 'bar', 2, 3)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L153_C4", "label": "expression", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "vector": [8, 2, 0.1721, 0.0011, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L154_C4", "label": "for annotations", "type": "for", "loc": [154, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "vector": [6, 2, 0.1744, 0.0034, 2, 0.85, 0.5, 398, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotations in self._store.values():\n for annotation in annotations:\n annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L155_C6", "label": "for annotation", "type": "for", "loc": [155, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L154_C4", "vector": [6, 3, 0.1749, 0.0022, 3, 0.45, 0.0, 792, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotation in annotations:\n annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L156_C8", "label": "_shift()", "type": "expression", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L155_C6", "vector": [8, 4, 0.1755, 0.0011, 4, 0.21, 0.0, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "label": "for name, annotations", "type": "for", "loc": [160, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "vector": [6, 2, 0.1907, 0.0225, 2, 0.85, 1.0, 964, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "name, annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, annotations in self._store.items():\n new_list = []\n for i, annotation in enumerate(annotations):\n name = annotation.name\n value = annotation.value\n start = annotation.start\n end = annotation.end\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L161_C6", "label": "new_list =", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "vector": [14, 3, 0.1811, 0.0011, 3, 0.14, 0.0, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "label": "for i, annotation", "type": "for", "loc": [162, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "vector": [6, 3, 0.1912, 0.0191, 3, 0.14, 0.5, 576, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, annotation in enumerate(annotations):\n name = annotation.name\n value = annotation.value\n start = annotation.start\n end = annotation.end\n\n # Find the last end index.\n for j, next_annotation in enumerate(annotations[i + 1:]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L163_C8", "label": "name =", "type": "assigned_variable", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [14, 4, 0.1834, 0.0011, 4, 0.72, 0.0, 57, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = annotation.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L164_C8", "label": "value =", "type": "assigned_variable", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [14, 4, 0.1845, 0.0011, 4, 0.72, 0.2, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = annotation.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L165_C8", "label": "start =", "type": "assigned_variable", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [14, 4, 0.1856, 0.0011, 4, 0.72, 0.4, 511, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = annotation.start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L166_C8", "label": "end =", "type": "assigned_variable", "loc": [166, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [14, 4, 0.1867, 0.0011, 4, 0.72, 0.6, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8", "label": "for j, next_annotation", "type": "for", "loc": [169, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [6, 4, 0.1946, 0.0101, 4, 0.72, 0.8, 611, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j, next_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j, next_annotation in enumerate(annotations[i + 1:]):\n # Not contiguous, skip.\n if (end < next_annotation.start):\n break\n\n # Contiguous, merge.\n if (end == next_annotation.start and value == next_annotation.value):\n end = next_annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L171_C10", "label": "if", "type": "if", "loc": [171, 172], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8", "vector": [4, 5, 0.1929, 0.0022, 5, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (end < next_annotation.start):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L175_C10", "label": "if", "type": "if", "loc": [175, 177], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8", "vector": [4, 5, 0.198, 0.0034, 5, 0.33, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (end == next_annotation.start and value == next_annotation.value):\n end = next_annotation.end\n del annotations[j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L176_C12", "label": "end =", "type": "assigned_variable", "loc": [176, 176], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L175_C10", "vector": [14, 6, 0.198, 0.0011, 6, 0.99, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = next_annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L178_C8", "label": "append()", "type": "expression", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "vector": [8, 4, 0.2002, 0.0011, 4, 0.72, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, value, start, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L179_C6", "label": "assign", "type": "assigned_variable", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "vector": [14, 3, 0.2013, 0.0011, 3, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L181_C2", "label": "__len__", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.2042, 0.0022, 1, 0.48, 0.6, 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 return len(self._store)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L181_C2", "vector": [13, 2, 0.2047, 0.0011, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._store)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L184_C2", "label": "__getitem__", "type": "function", "loc": [184, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.2075, 0.0022, 1, 0.48, 0.7, 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._store[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L185_C4", "label": "return", "type": "return", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L184_C2", "vector": [13, 2, 0.2081, 0.0011, 2, 0.8, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._store[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L187_C2", "label": "__iter__", "type": "function", "loc": [187, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.212, 0.0045, 1, 0.48, 0.8, 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 for l in self._store.values():\n for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L188_C4", "label": "for l", "type": "for", "loc": [188, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L187_C2", "vector": [6, 2, 0.2126, 0.0034, 2, 0.42, 0.0, 810, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in self._store.values():\n for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L189_C6", "label": "for ann", "type": "for", "loc": [189, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L188_C4", "vector": [6, 3, 0.2132, 0.0022, 3, 0.55, 0.0, 763, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ann", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L190_C8", "label": "expression", "type": "expression", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L189_C6", "vector": [8, 4, 0.2137, 0.0011, 4, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2", "label": "names", "type": "function", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.2171, 0.0034, 1, 0.48, 0.9, 382, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "names", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def names(self):\n \"\"\"Return the names of the annotations in the store.\"\"\"\n return self._store.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L193_C4", "label": "expression", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2", "vector": [8, 2, 0.2171, 0.0011, 2, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the names of the annotations in the store.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L194_C4", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2", "vector": [13, 2, 0.2182, 0.0011, 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 self._store.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "label": "serialize", "type": "function", "loc": [196, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "vector": [2, 1, 0.2233, 0.0067, 1, 0.48, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a list of the serialized annotations.\"\"\"\n res = []\n for v in self._store.values():\n res += [a.serialize() for a in v]\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L197_C4", "label": "expression", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "vector": [8, 2, 0.2216, 0.0011, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a list of the serialized annotations.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L198_C4", "label": "res =", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "vector": [14, 2, 0.2227, 0.0011, 2, 0.97, 0.3333, 413, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L199_C4", "label": "for v", "type": "for", "loc": [199, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "vector": [6, 2, 0.2244, 0.0022, 2, 0.97, 0.6667, 553, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for v in self._store.values():\n res += [a.serialize() for a in v]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L201_C4", "label": "return", "type": "return", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "vector": [13, 2, 0.2261, 0.0011, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "label": "Blips", "type": "class", "loc": [204, 248], "level": 0, "parent": null, "vector": [3, 0, 0.2542, 0.0506, 0, 0.66, 0.7143, 32, 0, 8, 0, 0, 186, 0, 6], "semantic": {"name": "Blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Blips(object):\n \"\"\"A dictionary-like object containing the blips, keyed on blip ID.\"\"\"\n\n def __init__(self, blips):\n self._blips = blips\n\n def __getitem__(self, blip_id):\n return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L205_C2", "label": "expression", "type": "expression", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [8, 1, 0.2306, 0.0011, 1, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A dictionary-like object containing the blips, keyed on blip ID.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L207_C2", "label": "__init__", "type": "function", "loc": [207, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2334, 0.0022, 1, 0.49, 0.125, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "blips"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, blips):\n self._blips = blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L208_C4", "label": "self._blips =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L207_C2", "vector": [14, 2, 0.234, 0.0011, 2, 0.03, 0.0, 720, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blips = blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L210_C2", "label": "__getitem__", "type": "function", "loc": [210, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2368, 0.0022, 1, 0.49, 0.25, 698, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": ["self", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, blip_id):\n return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L211_C4", "label": "return", "type": "return", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L210_C2", "vector": [13, 2, 0.2373, 0.0011, 2, 0.12, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L213_C2", "label": "__iter__", "type": "function", "loc": [213, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2402, 0.0022, 1, 0.49, 0.375, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._blips.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L214_C4", "label": "return", "type": "return", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L213_C2", "vector": [13, 2, 0.2407, 0.0011, 2, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L216_C2", "label": "__len__", "type": "function", "loc": [216, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2435, 0.0022, 1, 0.49, 0.5, 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 return len(self._blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L217_C4", "label": "return", "type": "return", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L216_C2", "vector": [13, 2, 0.2441, 0.0011, 2, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L219_C2", "label": "_add", "type": "function", "loc": [219, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2469, 0.0022, 1, 0.49, 0.625, 840, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_add", "arg_names": ["self", "ablip"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _add(self, ablip):\n self._blips[ablip.blip_id] = ablip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L220_C4", "label": "assign", "type": "assigned_variable", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L219_C2", "vector": [14, 2, 0.2475, 0.0011, 2, 0.27, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blips[ablip.blip_id] = ablip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2", "label": "_remove_with_id", "type": "function", "loc": [222, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2537, 0.009, 1, 0.49, 0.75, 122, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": ["self", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _remove_with_id(self, blip_id):\n del_blip = self._blips[blip_id]\n if del_blip:\n # Remove the reference to this blip from its parent.\n parent_blip = self._blips[blip_id].parent_blip\n if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)\n del self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L223_C4", "label": "del_blip =", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2", "vector": [14, 2, 0.2508, 0.0011, 2, 0.51, 0.0, 492, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "del_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " del_blip = self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2", "vector": [4, 2, 0.2542, 0.0056, 2, 0.51, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if del_blip:\n # Remove the reference to this blip from its parent.\n parent_blip = self._blips[blip_id].parent_blip\n if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L226_C6", "label": "parent_blip =", "type": "assigned_variable", "loc": [226, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4", "vector": [14, 3, 0.2542, 0.0011, 3, 0.98, 0.0, 445, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent_blip = self._blips[blip_id].parent_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L227_C6", "label": "if", "type": "if", "loc": [227, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4", "vector": [4, 3, 0.2559, 0.0022, 3, 0.98, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L228_C8", "label": "remove()", "type": "expression", "loc": [228, 228], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L227_C6", "vector": [8, 4, 0.2565, 0.0011, 4, 0.8, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2", "label": "get", "type": "function", "loc": [231, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2638, 0.009, 1, 0.49, 0.875, 607, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self", "blip_id", "default_value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, blip_id, default_value=None):\n \"\"\"Retrieves a blip.\n\n Returns:\n A Blip object. If none found for the ID, it returns None,\n or if default_value is specified, it returns that.\n \"\"\"\n return self._blips.get(blip_id, default_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L232_C4", "label": "expression", "type": "expression", "loc": [232, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2", "vector": [8, 2, 0.2638, 0.0067, 2, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Retrieves a blip.\n\n Returns:\n A Blip object. If none found for the ID, it returns None,\n or if default_value is specified, it returns that.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L238_C4", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2", "vector": [13, 2, 0.2677, 0.0011, 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 self._blips.get(blip_id, default_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "label": "serialize", "type": "function", "loc": [240, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "vector": [2, 1, 0.2745, 0.0101, 1, 0.49, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the blips.\n Returns:\n A dict of serialized blips.\n \"\"\"\n res = {}\n for blip_id, item in self._blips.items():\n res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L241_C4", "label": "expression", "type": "expression", "loc": [241, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "vector": [8, 2, 0.2728, 0.0045, 2, 0.49, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the blips.\n Returns:\n A dict of serialized blips.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L245_C4", "label": "res =", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "vector": [14, 2, 0.2756, 0.0011, 2, 0.49, 0.3333, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L246_C4", "label": "for blip_id, item", "type": "for", "loc": [246, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "vector": [6, 2, 0.2773, 0.0022, 2, 0.49, 0.6667, 822, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "blip_id, item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for blip_id, item in self._blips.items():\n res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L247_C6", "label": " = serialize()", "type": "assigned_variable", "loc": [247, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L246_C4", "vector": [14, 3, 0.2778, 0.0011, 3, 0.5, 0.0, 0, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L248_C4", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "vector": [13, 2, 0.279, 0.0011, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "label": "BlipRefs", "type": "class", "loc": [251, 578], "level": 0, "parent": null, "vector": [3, 0, 0.4663, 0.369, 0, 0.66, 0.8571, 404, 0, 19, 0, 0, 186, 0, 76], "semantic": {"name": "BlipRefs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipRefs(object):\n \"\"\"Represents a set of references to contents in a blip.\n\n For example, a BlipRefs instance can represent the results\n of a search, an explicitly set range, a regular expression,\n or refer to the entire blip. BlipRefs are used to express\n operations on a blip in a consistent way that can easily\n be transfered to the server."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L252_C2", "label": "expression", "type": "expression", "loc": [252, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [8, 1, 0.2897, 0.0135, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Represents a set of references to contents in a blip.\n\n For example, a BlipRefs instance can represent the results\n of a search, an explicitly set range, a regular expression,\n or refer to the entire blip. BlipRefs are used to express\n operations on a blip in a consistent way that can easily\n be transfered to the server.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L265_C2", "label": "DELETE =", "type": "assigned_variable", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.2981, 0.0011, 1, 0.82, 0.0385, 77, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DELETE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " DELETE = 'DELETE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L266_C2", "label": "REPLACE =", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.2992, 0.0011, 1, 0.82, 0.0769, 96, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REPLACE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " REPLACE = 'REPLACE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L267_C2", "label": "INSERT =", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.3003, 0.0011, 1, 0.82, 0.1154, 414, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INSERT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INSERT = 'INSERT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L268_C2", "label": "INSERT_AFTER =", "type": "assigned_variable", "loc": [268, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.3015, 0.0011, 1, 0.82, 0.1538, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INSERT_AFTER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INSERT_AFTER = 'INSERT_AFTER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L269_C2", "label": "ANNOTATE =", "type": "assigned_variable", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.3026, 0.0011, 1, 0.82, 0.1923, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANNOTATE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ANNOTATE = 'ANNOTATE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L270_C2", "label": "CLEAR_ANNOTATION =", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.3037, 0.0011, 1, 0.82, 0.2308, 73, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CLEAR_ANNOTATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CLEAR_ANNOTATION = 'CLEAR_ANNOTATION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L271_C2", "label": "UPDATE_ELEMENT =", "type": "assigned_variable", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [14, 1, 0.3048, 0.0011, 1, 0.82, 0.2692, 592, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UPDATE_ELEMENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UPDATE_ELEMENT = 'UPDATE_ELEMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2", "label": "__init__", "type": "function", "loc": [273, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.3082, 0.0034, 1, 0.82, 0.3077, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "blip", "maxres"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, blip, maxres=1):\n self._blip = blip\n self._maxres = maxres"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L274_C4", "label": "self._blip =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2", "vector": [14, 2, 0.3082, 0.0011, 2, 0.62, 0.0, 818, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blip = blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L275_C4", "label": "self._maxres =", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2", "vector": [14, 2, 0.3093, 0.0011, 2, 0.62, 1.0, 117, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._maxres", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._maxres = maxres"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "label": "all", "type": "function", "loc": [278, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.3223, 0.0202, 1, 0.82, 0.3462, 895, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "all", "arg_names": ["cls", "blip", "findwhat", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def all(cls, blip, findwhat, maxres=-1, **restrictions):\n \"\"\"Construct an instance representing the search for text or elements.\"\"\"\n obj = cls(blip, maxres)\n obj._findwhat = findwhat\n obj._restrictions = restrictions\n obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)\n if findwhat is None:\n # No findWhat, take the entire blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L279_C4", "label": "expression", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [8, 2, 0.3138, 0.0011, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Construct an instance representing the search for text or elements.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L280_C4", "label": "obj = cls()", "type": "assigned_variable", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [14, 2, 0.315, 0.0011, 2, 0.04, 0.1667, 505, 3, 2, 0, 0, 594, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " obj = cls(blip, maxres)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L281_C4", "label": "obj._findwhat =", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [14, 2, 0.3161, 0.0011, 2, 0.04, 0.3333, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._findwhat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._findwhat = findwhat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L282_C4", "label": "obj._restrictions =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [14, 2, 0.3172, 0.0011, 2, 0.04, 0.5, 533, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._restrictions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._restrictions = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L283_C4", "label": "obj._hits =", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [14, 2, 0.3183, 0.0011, 2, 0.04, 0.6667, 363, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "obj._hits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "label": "if", "type": "if", "loc": [284, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [4, 2, 0.3251, 0.0124, 2, 0.04, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if findwhat is None:\n # No findWhat, take the entire blip\n obj._params = {}\n else:\n query = {'maxRes': maxres}\n if isinstance(findwhat, basestring):\n query['textMatch'] = findwhat\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L286_C6", "label": "obj._params =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "vector": [14, 3, 0.3217, 0.0011, 3, 0.5, 0.0, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L288_C6", "label": "query =", "type": "assigned_variable", "loc": [288, 288], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "vector": [14, 3, 0.324, 0.0011, 3, 0.5, 0.3333, 546, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = {'maxRes': maxres}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "label": "if", "type": "if", "loc": [289, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "vector": [4, 3, 0.3273, 0.0056, 3, 0.5, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(findwhat, basestring):\n query['textMatch'] = findwhat\n else:\n query['elementMatch'] = findwhat.class_type\n query['restrictions'] = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L290_C8", "label": "assign", "type": "assigned_variable", "loc": [290, 290], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "vector": [14, 4, 0.3262, 0.0011, 4, 0.63, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['textMatch'] = findwhat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L292_C8", "label": "assign", "type": "assigned_variable", "loc": [292, 292], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "vector": [14, 4, 0.3285, 0.0011, 4, 0.63, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['elementMatch'] = findwhat.class_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L293_C8", "label": "assign", "type": "assigned_variable", "loc": [293, 293], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "vector": [14, 4, 0.3296, 0.0011, 4, 0.63, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['restrictions'] = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L294_C6", "label": "obj._params =", "type": "assigned_variable", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "vector": [14, 3, 0.3307, 0.0011, 3, 0.5, 1.0, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {'modifyQuery': query}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L295_C4", "label": "return", "type": "return", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "vector": [13, 2, 0.3318, 0.0011, 2, 0.04, 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_1112:FunctionDef_L298_C2", "label": "range", "type": "function", "loc": [298, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.3391, 0.009, 1, 0.82, 0.3846, 816, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "range", "arg_names": ["cls", "blip", "begin", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def range(cls, blip, begin, end):\n \"\"\"Constructs an instance representing an explicitly set range.\"\"\"\n obj = cls(blip)\n obj._begin = begin\n obj._end = end\n obj._hits = lambda: [(begin, end)]\n obj._params = {'range': {'start': begin, 'end': end}}\n return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L299_C4", "label": "expression", "type": "expression", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [8, 2, 0.3363, 0.0011, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructs an instance representing an explicitly set range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L300_C4", "label": "obj = cls()", "type": "assigned_variable", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [14, 2, 0.3375, 0.0011, 2, 0.01, 0.1667, 505, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " obj = cls(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L301_C4", "label": "obj._begin =", "type": "assigned_variable", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [14, 2, 0.3386, 0.0011, 2, 0.01, 0.3333, 505, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._begin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._begin = begin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L302_C4", "label": "obj._end =", "type": "assigned_variable", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [14, 2, 0.3397, 0.0011, 2, 0.01, 0.5, 470, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L303_C4", "label": "obj._hits =", "type": "assigned_variable", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [14, 2, 0.3408, 0.0011, 2, 0.01, 0.6667, 363, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._hits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._hits = lambda: [(begin, end)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L304_C4", "label": "obj._params =", "type": "assigned_variable", "loc": [304, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [14, 2, 0.342, 0.0011, 2, 0.01, 0.8333, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {'range': {'start': begin, 'end': end}}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "vector": [13, 2, 0.3431, 0.0011, 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 obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "label": "_elem_matches", "type": "function", "loc": [307, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.3487, 0.0079, 1, 0.82, 0.4231, 781, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "_elem_matches", "arg_names": ["self", "elem", "clz", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _elem_matches(self, elem, clz, **restrictions):\n if not isinstance(elem, clz):\n return False\n for key, val in restrictions.items():\n if getattr(elem, key) != val:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "vector": [4, 2, 0.347, 0.0022, 2, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(elem, clz):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L309_C6", "label": "return", "type": "return", "loc": [309, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L308_C4", "vector": [13, 3, 0.3476, 0.0011, 3, 0.4, 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_1112:For_L310_C4", "label": "for key, val", "type": "for", "loc": [310, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "vector": [6, 2, 0.3498, 0.0034, 2, 0.19, 0.5, 372, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, val in restrictions.items():\n if getattr(elem, key) != val:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L311_C6", "label": "if", "type": "if", "loc": [311, 312], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L310_C4", "vector": [4, 3, 0.3504, 0.0022, 3, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(elem, key) != val:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L312_C8", "label": "return", "type": "return", "loc": [312, 312], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L311_C6", "vector": [13, 4, 0.351, 0.0011, 4, 0.49, 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_1112:Return_L313_C4", "label": "return", "type": "return", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "vector": [13, 2, 0.3521, 0.0011, 2, 0.19, 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_1112:FunctionDef_L315_C2", "label": "_find", "type": "function", "loc": [315, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.3763, 0.045, 1, 0.82, 0.4615, 779, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "_find", "arg_names": ["self", "what", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _find(self, what, maxres=-1, **restrictions):\n \"\"\"Iterates where 'what' occurs in the associated blip.\n\n What can be either a string or a class reference.\n Examples:\n self._find('hello') will return the first occurence of the word hello\n self._find(element.Gadget, url='http://example.com/gadget.xml')\n will return the first gadget that has as url example.com."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L316_C4", "label": "expression", "type": "expression", "loc": [316, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "vector": [8, 2, 0.365, 0.0202, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Iterates where 'what' occurs in the associated blip.\n\n What can be either a string or a class reference.\n Examples:\n self._find('hello') will return the first occurence of the word hello\n self._find(element.Gadget, url='http://example.com/gadget.xml')\n will return the first gadget that has as url example.com.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L334_C4", "label": "blip =", "type": "assigned_variable", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "vector": [14, 2, 0.3757, 0.0011, 2, 0.6, 0.3333, 134, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip = self._blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L335_C4", "label": "if", "type": "if", "loc": [335, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "vector": [4, 2, 0.378, 0.0034, 2, 0.6, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what is None:\n yield 0, len(blip)\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L336_C6", "label": "expression", "type": "expression", "loc": [336, 336], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L335_C4", "vector": [8, 3, 0.378, 0.0011, 3, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 0, len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "label": "if", "type": "if", "loc": [338, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "vector": [4, 2, 0.3892, 0.0191, 2, 0.6, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(what, basestring):\n idx = blip._content.find(what)\n count = 0\n while idx != -1:\n yield idx, idx + len(what)\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L339_C6", "label": "idx = find()", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "vector": [14, 3, 0.3813, 0.0011, 3, 0.04, 0.0, 187, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " idx = blip._content.find(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L340_C6", "label": "count =", "type": "assigned_variable", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "vector": [14, 3, 0.3825, 0.0011, 3, 0.04, 0.25, 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_1112:While_L341_C6", "label": "while", "type": "while", "loc": [341, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "vector": [5, 3, 0.3864, 0.0067, 3, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while idx != -1:\n yield idx, idx + len(what)\n count += 1\n if count == maxres:\n raise StopIteration\n idx = blip._content.find(what, idx + len(what))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L342_C8", "label": "expression", "type": "expression", "loc": [342, 342], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "vector": [8, 4, 0.3847, 0.0011, 4, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield idx, idx + len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L344_C8", "label": "if", "type": "if", "loc": [344, 345], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "vector": [4, 4, 0.3875, 0.0022, 4, 0.79, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L346_C8", "label": "idx = find()", "type": "assigned_variable", "loc": [346, 346], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "vector": [14, 4, 0.3892, 0.0011, 4, 0.79, 1.0, 187, 3, 2, 0, 0, 340, 10, 2], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " idx = blip._content.find(what, idx + len(what))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L348_C6", "label": "count =", "type": "assigned_variable", "loc": [348, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "vector": [14, 3, 0.3915, 0.0011, 3, 0.04, 0.75, 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_1112:For_L349_C6", "label": "for idx, el", "type": "for", "loc": [349, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "vector": [6, 3, 0.3954, 0.0067, 3, 0.04, 1.0, 946, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "idx, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, el in blip._elements.items():\n if self._elem_matches(el, what, **restrictions):\n yield idx, idx + 1\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8", "label": "if", "type": "if", "loc": [350, 354], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L349_C6", "vector": [4, 4, 0.396, 0.0056, 4, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._elem_matches(el, what, **restrictions):\n yield idx, idx + 1\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L351_C10", "label": "expression", "type": "expression", "loc": [351, 351], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8", "vector": [8, 5, 0.3948, 0.0011, 5, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield idx, idx + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L353_C10", "label": "if", "type": "if", "loc": [353, 354], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8", "vector": [4, 5, 0.3976, 0.0022, 5, 0.41, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "label": "_execute", "type": "function", "loc": [356, 499], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.4809, 0.162, 1, 0.82, 0.5, 205, 0, 4, 1, 0, 0, 0, 45], "semantic": {"name": "_execute", "arg_names": ["self", "modify_how", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _execute(self, modify_how, what, bundled_annotations=None):\n \"\"\"Executes this BlipRefs object.\n\n Args:\n modify_how: What to do. Any of the operation declared at the top.\n what: Depending on the operation. For delete, has to be None.\n For the others it is a singleton, a list or a function returning\n what to do; for ANNOTATE tuples of (key, value), for the others"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L357_C4", "label": "expression", "type": "expression", "loc": [357, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [8, 2, 0.4106, 0.0191, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Executes this BlipRefs object.\n\n Args:\n modify_how: What to do. Any of the operation declared at the top.\n what: Depending on the operation. For delete, has to be None.\n For the others it is a singleton, a list or a function returning\n what to do; for ANNOTATE tuples of (key, value), for the others\n either string or elements."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L374_C4", "label": "blip =", "type": "assigned_variable", "loc": [374, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.4207, 0.0011, 2, 0.0, 0.0667, 134, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip = self._blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4", "label": "if", "type": "if", "loc": [376, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [4, 2, 0.4246, 0.0045, 2, 0.0, 0.1333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how != BlipRefs.DELETE:\n if type(what) != list:\n what = [what]\n next_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L377_C6", "label": "if", "type": "if", "loc": [377, 378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4", "vector": [4, 3, 0.4246, 0.0022, 3, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(what) != list:\n what = [what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L378_C8", "label": "what =", "type": "assigned_variable", "loc": [378, 378], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L377_C6", "vector": [14, 4, 0.4252, 0.0011, 4, 0.96, 0.0, 63, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = [what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L379_C6", "label": "next_index =", "type": "assigned_variable", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4", "vector": [14, 3, 0.4263, 0.0011, 3, 0.63, 1.0, 91, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "next_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L381_C4", "label": "matched =", "type": "assigned_variable", "loc": [381, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.4286, 0.0011, 2, 0.0, 0.2, 962, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "matched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " matched = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L384_C4", "label": "updated_elements =", "type": "assigned_variable", "loc": [384, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.4319, 0.0011, 2, 0.0, 0.2667, 801, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "updated_elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " updated_elements = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L387_C4", "label": "next =", "type": "assigned_variable", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.4353, 0.0011, 2, 0.0, 0.3333, 11, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L388_C4", "label": "hit_found =", "type": "assigned_variable", "loc": [388, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.4364, 0.0011, 2, 0.0, 0.4, 491, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "hit_found", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hit_found = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "label": "for start, end", "type": "for", "loc": [390, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [6, 2, 0.4792, 0.0821, 2, 0.0, 0.4667, 670, 3, 0, 0, 0, 0, 0, 37], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n hit_found = True\n if start < 0:\n start += len(blip)\n if end == 0:\n end += len(blip)\n if end < 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L391_C6", "label": "hit_found =", "type": "assigned_variable", "loc": [391, 391], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "vector": [14, 3, 0.4398, 0.0011, 3, 0.15, 0.0, 491, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "hit_found", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hit_found = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L392_C6", "label": "if", "type": "if", "loc": [392, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "vector": [4, 3, 0.4426, 0.0045, 3, 0.15, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start < 0:\n start += len(blip)\n if end == 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L394_C8", "label": "if", "type": "if", "loc": [394, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L392_C6", "vector": [4, 4, 0.4438, 0.0022, 4, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end == 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L396_C6", "label": "if", "type": "if", "loc": [396, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "vector": [4, 3, 0.446, 0.0022, 3, 0.15, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end < 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6", "label": "if", "type": "if", "loc": [398, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "vector": [4, 3, 0.4499, 0.0056, 3, 0.15, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(blip) == 0:\n if start != 0 or end != 0:\n raise IndexError('Start and end have to be 0 for empty document')\n elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):\n raise IndexError('Position outside the document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L399_C8", "label": "if", "type": "if", "loc": [399, 400], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6", "vector": [4, 4, 0.4494, 0.0022, 4, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start != 0 or end != 0:\n raise IndexError('Start and end have to be 0 for empty document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L401_C6", "label": "if", "type": "if", "loc": [401, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6", "vector": [4, 4, 0.4516, 0.0022, 4, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):\n raise IndexError('Position outside the document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "label": "if", "type": "if", "loc": [403, 462], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "vector": [4, 3, 0.4865, 0.0675, 3, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 0, 28], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.DELETE:\n for i in range(start, end):\n if i in blip._elements:\n del blip._elements[i]\n blip._delete_annotations(start, end)\n blip._shift(end, start - end)\n blip._content = blip._content[:start] + blip._content[end:]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L404_C8", "label": "for i", "type": "for", "loc": [404, 406], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [6, 4, 0.4556, 0.0034, 4, 0.64, 0.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(start, end):\n if i in blip._elements:\n del blip._elements[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L405_C10", "label": "if", "type": "if", "loc": [405, 406], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L404_C8", "vector": [4, 5, 0.4561, 0.0022, 5, 0.8, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i in blip._elements:\n del blip._elements[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L407_C8", "label": "_delete_annotations()", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [8, 4, 0.4578, 0.0011, 4, 0.64, 0.1667, 741, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L408_C8", "label": "_shift()", "type": "expression", "loc": [408, 408], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [8, 4, 0.4589, 0.0011, 4, 0.64, 0.3333, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " blip._shift(end, start - end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L409_C8", "label": "blip._content =", "type": "assigned_variable", "loc": [409, 409], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [14, 4, 0.4601, 0.0011, 4, 0.64, 0.5, 401, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._content = blip._content[:start] + blip._content[end:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "label": "if", "type": "if", "loc": [411, 416], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [4, 4, 0.4651, 0.0067, 4, 0.64, 0.6667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(what):\n next = what(blip._content, start, end)\n matched.append(next)\n else:\n next = what[next_index]\n next_index = (next_index + 1) % len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L412_C10", "label": "next = what()", "type": "assigned_variable", "loc": [412, 412], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "vector": [14, 5, 0.4634, 0.0011, 5, 0.12, 0.0, 11, 3, 3, 0, 0, 63, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "what", "annotation": ""}, "snippet": " next = what(blip._content, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L413_C10", "label": "append()", "type": "expression", "loc": [413, 413], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "vector": [8, 5, 0.4646, 0.0011, 5, 0.12, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " matched.append(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L415_C10", "label": "next =", "type": "assigned_variable", "loc": [415, 415], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "vector": [14, 5, 0.4668, 0.0011, 5, 0.12, 0.6667, 11, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next = what[next_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L416_C10", "label": "next_index =", "type": "assigned_variable", "loc": [416, 416], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "vector": [14, 5, 0.4679, 0.0011, 5, 0.12, 1.0, 91, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "next_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next_index = (next_index + 1) % len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L417_C8", "label": "if", "type": "if", "loc": [417, 418], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [4, 4, 0.4696, 0.0022, 4, 0.64, 0.8333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, str):\n next = util.force_unicode(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L418_C10", "label": "next = force_unicode()", "type": "assigned_variable", "loc": [418, 418], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L417_C8", "vector": [14, 5, 0.4702, 0.0011, 5, 0.47, 0.0, 11, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " next = util.force_unicode(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "label": "if", "type": "if", "loc": [419, 462], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "vector": [4, 4, 0.4955, 0.0495, 4, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.ANNOTATE:\n key, value = next\n blip.annotations._add_internal(key, value, start, end)\n elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n blip.annotations._delete_internal(next, start, end)\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L420_C10", "label": "key, value =", "type": "assigned_variable", "loc": [420, 420], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "vector": [14, 5, 0.4724, 0.0011, 5, 0.77, 0.0, 839, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key, value = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L421_C10", "label": "_add_internal()", "type": "expression", "loc": [421, 421], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "vector": [8, 5, 0.4736, 0.0011, 5, 0.77, 0.5, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " blip.annotations._add_internal(key, value, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8", "label": "if", "type": "if", "loc": [422, 462], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "vector": [4, 5, 0.4972, 0.0461, 5, 0.77, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n blip.annotations._delete_internal(next, start, end)\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:\n raise ValueError('No element found at index %s' % start)\n # the passing around of types this way feels a bit dirty:\n updated_elements.append(element.Element.from_json({'type': el.type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L423_C10", "label": "_delete_internal()", "type": "expression", "loc": [423, 423], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8", "vector": [8, 6, 0.4758, 0.0011, 6, 0.6, 0.0, 221, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_internal", "annotation": ""}, "snippet": " blip.annotations._delete_internal(next, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "label": "if", "type": "if", "loc": [424, 462], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8", "vector": [4, 6, 0.4983, 0.0439, 6, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:\n raise ValueError('No element found at index %s' % start)\n # the passing around of types this way feels a bit dirty:\n updated_elements.append(element.Element.from_json({'type': el.type,\n 'properties': next}))\n for k, b in next.items():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L425_C10", "label": "el = get()", "type": "assigned_variable", "loc": [425, 425], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [14, 7, 0.4781, 0.0011, 7, 0.43, 0.0, 144, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " el = blip._elements.get(start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L426_C10", "label": "if", "type": "if", "loc": [426, 427], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.4798, 0.0022, 7, 0.43, 0.1, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element:\n raise ValueError('No element found at index %s' % start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L429_C10", "label": "append()", "type": "expression", "loc": [429, 430], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [8, 7, 0.4831, 0.0022, 7, 0.43, 0.2, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " updated_elements.append(element.Element.from_json({'type': el.type,\n 'properties': next}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L431_C10", "label": "for k, b", "type": "for", "loc": [431, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [6, 7, 0.4854, 0.0022, 7, 0.43, 0.3, 882, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, b in next.items():\n setattr(el, k, b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L432_C12", "label": "setattr()", "type": "expression", "loc": [432, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L431_C10", "vector": [8, 8, 0.4859, 0.0011, 8, 0.34, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(el, k, b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10", "label": "if", "type": "if", "loc": [434, 441], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.4921, 0.009, 7, 0.43, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.INSERT:\n end = start\n elif modify_how == BlipRefs.INSERT_AFTER:\n start = end\n elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L435_C12", "label": "end =", "type": "assigned_variable", "loc": [435, 435], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10", "vector": [14, 8, 0.4893, 0.0011, 8, 0.54, 0.0, 128, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10", "label": "if", "type": "if", "loc": [436, 441], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10", "vector": [4, 8, 0.4933, 0.0067, 8, 0.54, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.INSERT_AFTER:\n start = end\n elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L437_C12", "label": "start =", "type": "assigned_variable", "loc": [437, 437], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10", "vector": [14, 9, 0.4916, 0.0011, 9, 0.11, 0.0, 511, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L438_C10", "label": "if", "type": "if", "loc": [438, 441], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10", "vector": [4, 9, 0.4944, 0.0045, 9, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10", "label": "if", "type": "if", "loc": [443, 446], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.5, 0.0045, 7, 0.43, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, element.Element):\n text = ' '\n else:\n text = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L444_C12", "label": "text =", "type": "assigned_variable", "loc": [444, 444], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10", "vector": [14, 8, 0.4994, 0.0011, 8, 0.56, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = ' '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L446_C12", "label": "text =", "type": "assigned_variable", "loc": [446, 446], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10", "vector": [14, 8, 0.5017, 0.0011, 8, 0.56, 1.0, 439, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L450_C10", "label": "if", "type": "if", "loc": [450, 451], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.5067, 0.0022, 7, 0.43, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start != end and len(text) < end - start:\n blip._delete_annotations(start + len(text), end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L451_C12", "label": "_delete_annotations()", "type": "expression", "loc": [451, 451], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L450_C10", "vector": [8, 8, 0.5073, 0.0011, 8, 0.16, 0.0, 741, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start + len(text), end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L453_C10", "label": "_shift()", "type": "expression", "loc": [453, 453], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [8, 7, 0.5096, 0.0011, 7, 0.43, 0.7, 613, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " blip._shift(end, len(text) + start - end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L454_C10", "label": "blip._content =", "type": "assigned_variable", "loc": [454, 454], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [14, 7, 0.5107, 0.0011, 7, 0.43, 0.8, 401, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._content = blip._content[:start] + text + blip._content[end:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "label": "if", "type": "if", "loc": [455, 459], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.5141, 0.0056, 7, 0.43, 0.9, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bundled_annotations:\n end_annotation = start + len(text)\n blip._delete_annotations(start, end_annotation)\n for key, value in bundled_annotations:\n blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L456_C12", "label": "end_annotation =", "type": "assigned_variable", "loc": [456, 456], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "vector": [14, 8, 0.5129, 0.0011, 8, 0.55, 0.0, 943, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_annotation = start + len(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L457_C12", "label": "_delete_annotations()", "type": "expression", "loc": [457, 457], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "vector": [8, 8, 0.5141, 0.0011, 8, 0.55, 0.5, 741, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L458_C12", "label": "for key, value", "type": "for", "loc": [458, 459], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "vector": [6, 8, 0.5157, 0.0022, 8, 0.55, 1.0, 839, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in bundled_annotations:\n blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L459_C14", "label": "_add_internal()", "type": "expression", "loc": [459, 459], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L458_C12", "vector": [8, 9, 0.5163, 0.0011, 9, 0.83, 0.0, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L461_C10", "label": "if", "type": "if", "loc": [461, 462], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "vector": [4, 7, 0.5191, 0.0022, 7, 0.43, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, element.Element):\n blip._elements[start] = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L462_C12", "label": "assign", "type": "assigned_variable", "loc": [462, 462], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L461_C10", "vector": [14, 8, 0.5197, 0.0011, 8, 0.96, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._elements[start] = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L465_C4", "label": "if", "type": "if", "loc": [465, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [4, 2, 0.5236, 0.0022, 2, 0.0, 0.5333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hit_found:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L466_C6", "label": "return", "type": "return", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L465_C4", "vector": [13, 3, 0.5242, 0.0011, 3, 0.84, 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_1112:Assign_L468_C4", "label": "operation = document_modify()", "type": "assigned_variable", "loc": [468, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.5276, 0.0034, 2, 0.0, 0.6, 870, 3, 3, 0, 0, 155, 10, 1], "semantic": {"name": "operation", "arg_names": [], "import_names": [], "rhs_call_name": "document_modify", "annotation": ""}, "snippet": " operation = blip._operation_queue.document_modify(blip.wave_id,\n blip.wavelet_id,\n blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L471_C4", "label": "for param, value", "type": "for", "loc": [471, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [6, 2, 0.5304, 0.0022, 2, 0.0, 0.6667, 242, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "param, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param, value in self._params.items():\n operation.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L472_C6", "label": "set_param()", "type": "expression", "loc": [472, 472], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L471_C4", "vector": [8, 3, 0.5309, 0.0011, 3, 0.7, 0.0, 696, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_param", "arg_names": [], "import_names": [], "rhs_call_name": "set_param", "annotation": ""}, "snippet": " operation.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L474_C4", "label": "modify_action =", "type": "assigned_variable", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [14, 2, 0.5332, 0.0011, 2, 0.0, 0.7333, 578, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "modify_action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action = {'modifyHow': modify_how}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L475_C4", "label": "if", "type": "if", "loc": [475, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [4, 2, 0.5444, 0.0214, 2, 0.0, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.DELETE:\n pass\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n modify_action['elements'] = updated_elements\n elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4", "label": "if", "type": "if", "loc": [477, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L475_C4", "vector": [4, 3, 0.5456, 0.0191, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.UPDATE_ELEMENT:\n modify_action['elements'] = updated_elements\n elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):\n what = matched\n if what:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L478_C6", "label": "assign", "type": "assigned_variable", "loc": [478, 478], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4", "vector": [14, 4, 0.5377, 0.0011, 4, 0.75, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['elements'] = updated_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "label": "if", "type": "if", "loc": [479, 493], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4", "vector": [4, 4, 0.5467, 0.0169, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):\n what = matched\n if what:\n if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L482_C6", "label": "if", "type": "if", "loc": [482, 483], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "vector": [4, 5, 0.5427, 0.0022, 5, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(what):\n what = matched"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L483_C8", "label": "what =", "type": "assigned_variable", "loc": [483, 483], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L482_C6", "vector": [14, 6, 0.5433, 0.0011, 6, 0.07, 0.0, 63, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = matched"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L484_C6", "label": "if", "type": "if", "loc": [484, 488], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "vector": [4, 5, 0.5467, 0.0056, 5, 0.7, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what:\n if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]\n else:\n modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8", "label": "if", "type": "if", "loc": [485, 488], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L484_C6", "vector": [4, 6, 0.5472, 0.0045, 6, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]\n else:\n modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L486_C10", "label": "assign", "type": "assigned_variable", "loc": [486, 486], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8", "vector": [14, 7, 0.5467, 0.0011, 7, 0.75, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['values'] = [util.force_unicode(value) for value in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L488_C10", "label": "assign", "type": "assigned_variable", "loc": [488, 488], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8", "vector": [14, 7, 0.5489, 0.0011, 7, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "label": "if", "type": "if", "loc": [489, 493], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "vector": [4, 5, 0.5523, 0.0056, 5, 0.7, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.ANNOTATE:\n modify_action['values'] = [x[1] for x in what]\n modify_action['annotationKey'] = what[0][0]\n elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L490_C6", "label": "assign", "type": "assigned_variable", "loc": [490, 490], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "vector": [14, 6, 0.5512, 0.0011, 6, 0.2, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['values'] = [x[1] for x in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L491_C6", "label": "assign", "type": "assigned_variable", "loc": [491, 491], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "vector": [14, 6, 0.5523, 0.0011, 6, 0.2, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['annotationKey'] = what[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L492_C4", "label": "if", "type": "if", "loc": [492, 493], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "vector": [4, 6, 0.554, 0.0022, 6, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L493_C6", "label": "assign", "type": "assigned_variable", "loc": [493, 493], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L492_C4", "vector": [14, 7, 0.5546, 0.0011, 7, 0.24, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L494_C4", "label": "if", "type": "if", "loc": [494, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [4, 2, 0.5568, 0.0034, 2, 0.0, 0.8667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bundled_annotations:\n modify_action['bundledAnnotations'] = [\n {'key': key, 'value': value} for key, value in bundled_annotations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L495_C6", "label": "assign", "type": "assigned_variable", "loc": [495, 496], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L494_C4", "vector": [14, 3, 0.5574, 0.0022, 3, 0.44, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['bundledAnnotations'] = [\n {'key': key, 'value': value} for key, value in bundled_annotations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L497_C4", "label": "set_param()", "type": "expression", "loc": [497, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [8, 2, 0.5591, 0.0011, 2, 0.0, 0.9333, 696, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_param", "arg_names": [], "import_names": [], "rhs_call_name": "set_param", "annotation": ""}, "snippet": " operation.set_param('modifyAction', modify_action)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L499_C4", "label": "return", "type": "return", "loc": [499, 499], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "vector": [13, 2, 0.5613, 0.0011, 2, 0.0, 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_1112:FunctionDef_L501_C2", "label": "insert", "type": "function", "loc": [501, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.5652, 0.0045, 1, 0.82, 0.5385, 368, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, what, bundled_annotations=None):\n \"\"\"Inserts what at the matched positions.\"\"\"\n return self._execute(\n BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L502_C4", "label": "expression", "type": "expression", "loc": [502, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L501_C2", "vector": [8, 2, 0.5647, 0.0011, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts what at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L503_C4", "label": "return", "type": "return", "loc": [503, 504], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L501_C2", "vector": [13, 2, 0.5664, 0.0022, 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 self._execute(\n BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2", "label": "insert_after", "type": "function", "loc": [506, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.5709, 0.0045, 1, 0.82, 0.5769, 441, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "insert_after", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert_after(self, what, bundled_annotations=None):\n \"\"\"Inserts what just after the matched positions.\"\"\"\n return self._execute(\n BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L507_C4", "label": "expression", "type": "expression", "loc": [507, 507], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2", "vector": [8, 2, 0.5703, 0.0011, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts what just after the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L508_C4", "label": "return", "type": "return", "loc": [508, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2", "vector": [13, 2, 0.572, 0.0022, 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 self._execute(\n BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2", "label": "replace", "type": "function", "loc": [511, 514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.5765, 0.0045, 1, 0.82, 0.6154, 293, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(self, what, bundled_annotations=None):\n \"\"\"Replaces the matched positions with what.\"\"\"\n return self._execute(\n BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L512_C4", "label": "expression", "type": "expression", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2", "vector": [8, 2, 0.5759, 0.0011, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Replaces the matched positions with what.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L513_C4", "label": "return", "type": "return", "loc": [513, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2", "vector": [13, 2, 0.5776, 0.0022, 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._execute(\n BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2", "label": "delete", "type": "function", "loc": [516, 518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.5816, 0.0034, 1, 0.82, 0.6538, 266, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self):\n \"\"\"Deletes the content at the matched positions.\"\"\"\n return self._execute(BlipRefs.DELETE, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L517_C4", "label": "expression", "type": "expression", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2", "vector": [8, 2, 0.5816, 0.0011, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deletes the content at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L518_C4", "label": "return", "type": "return", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2", "vector": [13, 2, 0.5827, 0.0011, 2, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._execute(BlipRefs.DELETE, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "label": "annotate", "type": "function", "loc": [520, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.5911, 0.0135, 1, 0.82, 0.6923, 296, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def annotate(self, name, value=None):\n \"\"\"Annotates the content at the matched positions.\n\n You can either specify both name and value to set the\n same annotation, or supply as the first parameter something\n that yields name/value pairs. The name and value should both be strings.\n \"\"\"\n if value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L521_C4", "label": "expression", "type": "expression", "loc": [521, 526], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "vector": [8, 2, 0.5889, 0.0067, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Annotates the content at the matched positions.\n\n You can either specify both name and value to set the\n same annotation, or supply as the first parameter something\n that yields name/value pairs. The name and value should both be strings.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4", "label": "if", "type": "if", "loc": [527, 530], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "vector": [4, 2, 0.5945, 0.0045, 2, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n what = name\n else:\n what = (name, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L528_C6", "label": "what =", "type": "assigned_variable", "loc": [528, 528], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4", "vector": [14, 3, 0.5939, 0.0011, 3, 0.75, 0.0, 63, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L530_C6", "label": "what =", "type": "assigned_variable", "loc": [530, 530], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4", "vector": [14, 3, 0.5962, 0.0011, 3, 0.75, 1.0, 63, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = (name, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L531_C4", "label": "return", "type": "return", "loc": [531, 531], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "vector": [13, 2, 0.5973, 0.0011, 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._execute(BlipRefs.ANNOTATE, what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2", "label": "clear_annotation", "type": "function", "loc": [533, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.6007, 0.0034, 1, 0.82, 0.7308, 359, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "clear_annotation", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear_annotation(self, name):\n \"\"\"Clears the annotation at the matched positions.\"\"\"\n return self._execute(BlipRefs.CLEAR_ANNOTATION, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L534_C4", "label": "expression", "type": "expression", "loc": [534, 534], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2", "vector": [8, 2, 0.6007, 0.0011, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Clears the annotation at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L535_C4", "label": "return", "type": "return", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2", "vector": [13, 2, 0.6018, 0.0011, 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._execute(BlipRefs.CLEAR_ANNOTATION, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2", "label": "update_element", "type": "function", "loc": [537, 539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.6052, 0.0034, 1, 0.82, 0.7692, 879, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": ["self", "new_values"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_element(self, new_values):\n \"\"\"Update an existing element with a set of new values.\"\"\"\n return self._execute(BlipRefs.UPDATE_ELEMENT, new_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L538_C4", "label": "expression", "type": "expression", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2", "vector": [8, 2, 0.6052, 0.0011, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Update an existing element with a set of new values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L539_C4", "label": "return", "type": "return", "loc": [539, 539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2", "vector": [13, 2, 0.6063, 0.0011, 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._execute(BlipRefs.UPDATE_ELEMENT, new_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "label": "__nonzero__", "type": "function", "loc": [541, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.6108, 0.0056, 1, 0.82, 0.8077, 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 whether we have a value.\"\"\"\n for start, end in self._hits():\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L542_C4", "label": "expression", "type": "expression", "loc": [542, 542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "vector": [8, 2, 0.6097, 0.0011, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return whether we have a value.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L543_C4", "label": "for start, end", "type": "for", "loc": [543, 544], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "vector": [6, 2, 0.6114, 0.0022, 2, 0.13, 0.5, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L544_C6", "label": "return", "type": "return", "loc": [544, 544], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L543_C4", "vector": [13, 3, 0.6119, 0.0011, 3, 0.38, 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_1112:Return_L545_C4", "label": "return", "type": "return", "loc": [545, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "vector": [13, 2, 0.613, 0.0011, 2, 0.13, 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_1112:FunctionDef_L547_C2", "label": "value", "type": "function", "loc": [547, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.6192, 0.009, 1, 0.82, 0.8462, 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 \"\"\"Convenience method to convert a BlipRefs to value of its first match.\"\"\"\n for start, end in self._hits():\n if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]\n raise ValueError('BlipRefs has no values')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L548_C4", "label": "expression", "type": "expression", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L547_C2", "vector": [8, 2, 0.6164, 0.0011, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convenience method to convert a BlipRefs to value of its first match.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L549_C4", "label": "for start, end", "type": "for", "loc": [549, 553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L547_C2", "vector": [6, 2, 0.6198, 0.0056, 2, 0.82, 1.0, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6", "label": "if", "type": "if", "loc": [550, 553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L549_C4", "vector": [4, 3, 0.6204, 0.0045, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L551_C8", "label": "return", "type": "return", "loc": [551, 551], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6", "vector": [13, 4, 0.6198, 0.0011, 4, 0.8, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip._elements[start]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L553_C8", "label": "return", "type": "return", "loc": [553, 553], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6", "vector": [13, 4, 0.622, 0.0011, 4, 0.8, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2", "label": "__getattr__", "type": "function", "loc": [556, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.631, 0.0124, 1, 0.82, 0.8846, 210, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__getattr__", "arg_names": ["self", "attribute"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, attribute):\n \"\"\"Mirror the getattr of value().\n\n This allows for clever things like\n first(IMAGE).url\n\n or\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L557_C4", "label": "expression", "type": "expression", "loc": [557, 565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2", "vector": [8, 2, 0.631, 0.0101, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mirror the getattr of value().\n\n This allows for clever things like\n first(IMAGE).url\n\n or\n\n blip.annotate_with(key, value).upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L566_C4", "label": "return", "type": "return", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2", "vector": [13, 2, 0.6367, 0.0011, 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 getattr(self.value(), attribute)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2", "label": "__radd__", "type": "function", "loc": [568, 570], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.64, 0.0034, 1, 0.82, 0.9231, 241, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__radd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __radd__(self, other):\n \"\"\"Make it possible to add this to a string.\"\"\"\n return other + self.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L569_C4", "label": "expression", "type": "expression", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2", "vector": [8, 2, 0.64, 0.0011, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Make it possible to add this to a string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L570_C4", "label": "return", "type": "return", "loc": [570, 570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2", "vector": [13, 2, 0.6412, 0.0011, 2, 0.99, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return other + self.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2", "label": "__cmp__", "type": "function", "loc": [572, 574], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.6445, 0.0034, 1, 0.82, 0.9615, 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 \"\"\"Support comparision with target.\"\"\"\n return cmp(self.value(), other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L573_C4", "label": "expression", "type": "expression", "loc": [573, 573], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2", "vector": [8, 2, 0.6445, 0.0011, 2, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Support comparision with target.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L574_C4", "label": "return", "type": "return", "loc": [574, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2", "vector": [13, 2, 0.6457, 0.0011, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(self.value(), other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L576_C2", "label": "__iter__", "type": "function", "loc": [576, 578], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "vector": [2, 1, 0.649, 0.0034, 1, 0.82, 1.0, 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 for start_end in self._hits():\n yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L577_C4", "label": "for start_end", "type": "for", "loc": [577, 578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L576_C2", "vector": [6, 2, 0.6496, 0.0022, 2, 0.5, 0.0, 220, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start_end in self._hits():\n yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L578_C6", "label": "expression", "type": "expression", "loc": [578, 578], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L577_C4", "vector": [8, 3, 0.6502, 0.0011, 3, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "label": "Blip", "type": "class", "loc": [581, 889], "level": 0, "parent": null, "vector": [3, 0, 0.8268, 0.3476, 0, 0.66, 1.0, 762, 0, 34, 0, 0, 186, 0, 63], "semantic": {"name": "Blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Blip(object):\n \"\"\"Models a single blip instance.\n\n Blips are essentially the documents that make up a conversation. Blips can\n live in a hierarchy of blips. A root blip has no parent blip id, but all\n blips have the ids of the wave and wavelet that they are associated with.\n\n Blips also contain annotations, content and elements, which are accessed via"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L582_C2", "label": "expression", "type": "expression", "loc": [582, 590], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [8, 1, 0.6592, 0.0101, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models a single blip instance.\n\n Blips are essentially the documents that make up a conversation. Blips can\n live in a hierarchy of blips. A root blip has no parent blip id, but all\n blips have the ids of the wave and wavelet that they are associated with.\n\n Blips also contain annotations, content and elements, which are accessed via\n the Document object."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "label": "__init__", "type": "function", "loc": [592, 628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.6862, 0.0416, 1, 0.64, 0.0294, 555, 0, 4, 0, 0, 0, 0, 20], "semantic": {"name": "__init__", "arg_names": ["self", "json", "other_blips", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, other_blips, operation_queue):\n \"\"\"Inits this blip with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n other_blips: A dictionary like object that can be used to resolve\n ids of blips to blips.\n operation_queue: an OperationQueue object to store generated operations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L593_C4", "label": "expression", "type": "expression", "loc": [593, 601], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [8, 2, 0.6715, 0.0101, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this blip with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n other_blips: A dictionary like object that can be used to resolve\n ids of blips to blips.\n operation_queue: an OperationQueue object to store generated operations\n in."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L602_C4", "label": "self._blip_id = get()", "type": "assigned_variable", "loc": [602, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6772, 0.0011, 2, 0.71, 0.0556, 70, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._blip_id = json.get('blipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L603_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [603, 603], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6783, 0.0011, 2, 0.71, 0.1111, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L604_C4", "label": "self._child_blip_ids = set()", "type": "assigned_variable", "loc": [604, 604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6794, 0.0011, 2, 0.71, 0.1667, 595, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "self._child_blip_ids", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._child_blip_ids = set(json.get('childBlipIds', []))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L605_C4", "label": "self._content = get()", "type": "assigned_variable", "loc": [605, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6805, 0.0011, 2, 0.71, 0.2222, 620, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._content", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._content = json.get('content', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L606_C4", "label": "self._contributors = set()", "type": "assigned_variable", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6817, 0.0011, 2, 0.71, 0.2778, 892, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "self._contributors", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._contributors = set(json.get('contributors', []))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L607_C4", "label": "self._creator = get()", "type": "assigned_variable", "loc": [607, 607], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6828, 0.0011, 2, 0.71, 0.3333, 777, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._creator", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creator = json.get('creator')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L608_C4", "label": "self._last_modified_time = get()", "type": "assigned_variable", "loc": [608, 608], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6839, 0.0011, 2, 0.71, 0.3889, 351, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._last_modified_time = json.get('lastModifiedTime', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L609_C4", "label": "self._version = get()", "type": "assigned_variable", "loc": [609, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.685, 0.0011, 2, 0.71, 0.4444, 711, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._version", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._version = json.get('version', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L610_C4", "label": "self._parent_blip_id = get()", "type": "assigned_variable", "loc": [610, 610], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6862, 0.0011, 2, 0.71, 0.5, 159, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._parent_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._parent_blip_id = json.get('parentBlipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L611_C4", "label": "self._wave_id = get()", "type": "assigned_variable", "loc": [611, 611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6873, 0.0011, 2, 0.71, 0.5556, 26, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wave_id = json.get('waveId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L612_C4", "label": "self._wavelet_id = get()", "type": "assigned_variable", "loc": [612, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.6884, 0.0011, 2, 0.71, 0.6111, 575, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wavelet_id = json.get('waveletId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4", "label": "if", "type": "if", "loc": [613, 616], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [4, 2, 0.6912, 0.0045, 2, 0.71, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other_blips, Blips):\n self._other_blips = other_blips\n else:\n self._other_blips = Blips(other_blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L614_C6", "label": "self._other_blips =", "type": "assigned_variable", "loc": [614, 614], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4", "vector": [14, 3, 0.6907, 0.0011, 3, 0.75, 0.0, 542, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._other_blips = other_blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L616_C6", "label": "self._other_blips = Blips()", "type": "assigned_variable", "loc": [616, 616], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4", "vector": [14, 3, 0.6929, 0.0011, 3, 0.75, 1.0, 542, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "self._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " self._other_blips = Blips(other_blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L617_C4", "label": "self._annotations = Annotations()", "type": "assigned_variable", "loc": [617, 617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.694, 0.0011, 2, 0.71, 0.7222, 683, 3, 2, 0, 0, 781, 10, 1], "semantic": {"name": "self._annotations", "arg_names": [], "import_names": [], "rhs_call_name": "Annotations", "annotation": ""}, "snippet": " self._annotations = Annotations(operation_queue, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4", "label": "for annjson", "type": "for", "loc": [618, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [6, 2, 0.698, 0.0067, 2, 0.71, 0.7778, 294, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annjson", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annjson in json.get('annotations', []):\n r = annjson['range']\n self._annotations._add_internal(annjson['name'],\n annjson['value'],\n r['start'],\n r['end'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L619_C6", "label": "r =", "type": "assigned_variable", "loc": [619, 619], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4", "vector": [14, 3, 0.6963, 0.0011, 3, 0.51, 0.0, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = annjson['range']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L620_C6", "label": "_add_internal()", "type": "expression", "loc": [620, 623], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4", "vector": [8, 3, 0.6991, 0.0045, 3, 0.51, 1.0, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " self._annotations._add_internal(annjson['name'],\n annjson['value'],\n r['start'],\n r['end'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L624_C4", "label": "self._elements =", "type": "assigned_variable", "loc": [624, 624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.7019, 0.0011, 2, 0.71, 0.8333, 809, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._elements = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L625_C4", "label": "json_elements = get()", "type": "assigned_variable", "loc": [625, 625], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.703, 0.0011, 2, 0.71, 0.8889, 180, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "json_elements", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " json_elements = json.get('elements', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L626_C4", "label": "for elem", "type": "for", "loc": [626, 627], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [6, 2, 0.7047, 0.0022, 2, 0.71, 0.9444, 63, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in json_elements:\n self._elements[int(elem)] = element.Element.from_json(json_elements[elem])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L627_C6", "label": " = from_json()", "type": "assigned_variable", "loc": [627, 627], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L626_C4", "vector": [14, 3, 0.7053, 0.0011, 3, 0.89, 0.0, 0, 3, 1, 0, 0, 975, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " self._elements[int(elem)] = element.Element.from_json(json_elements[elem])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L628_C4", "label": "self.raw_data =", "type": "assigned_variable", "loc": [628, 628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "vector": [14, 2, 0.7064, 0.0011, 2, 0.71, 1.0, 25, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2", "label": "blip_id", "type": "function", "loc": [631, 633], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7109, 0.0034, 1, 0.64, 0.0588, 161, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_id(self):\n \"\"\"The id of this blip.\"\"\"\n return self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L632_C4", "label": "expression", "type": "expression", "loc": [632, 632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2", "vector": [8, 2, 0.7109, 0.0011, 2, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L633_C4", "label": "return", "type": "return", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2", "vector": [13, 2, 0.712, 0.0011, 2, 0.29, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2", "label": "wave_id", "type": "function", "loc": [636, 638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7165, 0.0034, 1, 0.64, 0.0882, 347, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wave_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wave_id(self):\n \"\"\"The id of the wave that this blip belongs to.\"\"\"\n return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L637_C4", "label": "expression", "type": "expression", "loc": [637, 637], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2", "vector": [8, 2, 0.7165, 0.0011, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of the wave that this blip belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L638_C4", "label": "return", "type": "return", "loc": [638, 638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2", "vector": [13, 2, 0.7177, 0.0011, 2, 0.11, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2", "label": "wavelet_id", "type": "function", "loc": [641, 643], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7222, 0.0034, 1, 0.64, 0.1176, 269, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_id(self):\n \"\"\"The id of the wavelet that this blip belongs to.\"\"\"\n return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L642_C4", "label": "expression", "type": "expression", "loc": [642, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2", "vector": [8, 2, 0.7222, 0.0011, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of the wavelet that this blip belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L643_C4", "label": "return", "type": "return", "loc": [643, 643], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2", "vector": [13, 2, 0.7233, 0.0011, 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._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2", "label": "child_blip_ids", "type": "function", "loc": [646, 648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7278, 0.0034, 1, 0.64, 0.1471, 660, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "child_blip_ids", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def child_blip_ids(self):\n \"\"\"The set of the ids of this blip's children.\"\"\"\n return self._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L647_C4", "label": "expression", "type": "expression", "loc": [647, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2", "vector": [8, 2, 0.7278, 0.0011, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of the ids of this blip's children.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L648_C4", "label": "return", "type": "return", "loc": [648, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2", "vector": [13, 2, 0.7289, 0.0011, 2, 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._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2", "label": "child_blips", "type": "function", "loc": [651, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.734, 0.0045, 1, 0.64, 0.1765, 177, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "child_blips", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def child_blips(self):\n \"\"\"The set of blips that are children of this blip.\"\"\"\n return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids\n if blid_id in self._other_blips])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L652_C4", "label": "expression", "type": "expression", "loc": [652, 652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2", "vector": [8, 2, 0.7334, 0.0011, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of blips that are children of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L653_C4", "label": "return", "type": "return", "loc": [653, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2", "vector": [13, 2, 0.7351, 0.0022, 2, 0.61, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids\n if blid_id in self._other_blips])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2", "label": "contributors", "type": "function", "loc": [657, 659], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7402, 0.0034, 1, 0.64, 0.2059, 663, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "contributors", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contributors(self):\n \"\"\"The set of participant ids that contributed to this blip.\"\"\"\n return self._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L658_C4", "label": "expression", "type": "expression", "loc": [658, 658], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2", "vector": [8, 2, 0.7402, 0.0011, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of participant ids that contributed to this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L659_C4", "label": "return", "type": "return", "loc": [659, 659], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2", "vector": [13, 2, 0.7413, 0.0011, 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._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2", "label": "creator", "type": "function", "loc": [662, 664], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7458, 0.0034, 1, 0.64, 0.2353, 608, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creator(self):\n \"\"\"The id of the participant that created this blip.\"\"\"\n return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L663_C4", "label": "expression", "type": "expression", "loc": [663, 663], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2", "vector": [8, 2, 0.7458, 0.0011, 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 id of the participant that created this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L664_C4", "label": "return", "type": "return", "loc": [664, 664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2", "vector": [13, 2, 0.7469, 0.0011, 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._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2", "label": "last_modified_time", "type": "function", "loc": [667, 669], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7514, 0.0034, 1, 0.64, 0.2647, 538, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "last_modified_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def last_modified_time(self):\n \"\"\"The time in seconds since epoch when this blip was last modified.\"\"\"\n return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L668_C4", "label": "expression", "type": "expression", "loc": [668, 668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2", "vector": [8, 2, 0.7514, 0.0011, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The time in seconds since epoch when this blip was last modified.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L669_C4", "label": "return", "type": "return", "loc": [669, 669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2", "vector": [13, 2, 0.7525, 0.0011, 2, 0.91, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2", "label": "version", "type": "function", "loc": [672, 674], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.757, 0.0034, 1, 0.64, 0.2941, 623, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def version(self):\n \"\"\"The version of this blip.\"\"\"\n return self._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L673_C4", "label": "expression", "type": "expression", "loc": [673, 673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2", "vector": [8, 2, 0.757, 0.0011, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The version of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L674_C4", "label": "return", "type": "return", "loc": [674, 674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2", "vector": [13, 2, 0.7582, 0.0011, 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._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2", "label": "parent_blip_id", "type": "function", "loc": [677, 679], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7627, 0.0034, 1, 0.64, 0.3235, 196, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "parent_blip_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parent_blip_id(self):\n \"\"\"The parent blip_id or None if this is the root blip.\"\"\"\n return self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L678_C4", "label": "expression", "type": "expression", "loc": [678, 678], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2", "vector": [8, 2, 0.7627, 0.0011, 2, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The parent blip_id or None if this is the root blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L679_C4", "label": "return", "type": "return", "loc": [679, 679], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2", "vector": [13, 2, 0.7638, 0.0011, 2, 0.22, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2", "label": "parent_blip", "type": "function", "loc": [682, 685], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7688, 0.0045, 1, 0.64, 0.3529, 445, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "parent_blip", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parent_blip(self):\n \"\"\"The parent blip or None if it is the root.\"\"\"\n # if parent_blip_id is None, get will also return None\n return self._other_blips.get(self._parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L683_C4", "label": "expression", "type": "expression", "loc": [683, 683], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2", "vector": [8, 2, 0.7683, 0.0011, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The parent blip or None if it is the root.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L685_C4", "label": "return", "type": "return", "loc": [685, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2", "vector": [13, 2, 0.7705, 0.0011, 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 self._other_blips.get(self._parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "label": "inline_blip_offset", "type": "function", "loc": [688, 700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7807, 0.0146, 1, 0.64, 0.3824, 397, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "inline_blip_offset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def inline_blip_offset(self):\n \"\"\"The offset in the parent if this blip is inline or -1 if not.\n\n If the parent is not in the context, this function will always\n return -1 since it can't determine the inline blip status.\n \"\"\"\n parent = self.parent_blip\n if not parent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L689_C4", "label": "expression", "type": "expression", "loc": [689, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "vector": [8, 2, 0.7773, 0.0056, 2, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The offset in the parent if this blip is inline or -1 if not.\n\n If the parent is not in the context, this function will always\n return -1 since it can't determine the inline blip status.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L694_C4", "label": "parent =", "type": "assigned_variable", "loc": [694, 694], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "vector": [14, 2, 0.7807, 0.0011, 2, 0.84, 0.25, 80, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent = self.parent_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L695_C4", "label": "if", "type": "if", "loc": [695, 696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "vector": [4, 2, 0.7823, 0.0022, 2, 0.84, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parent:\n return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L696_C6", "label": "return", "type": "return", "loc": [696, 696], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L695_C4", "vector": [13, 3, 0.7829, 0.0011, 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 -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L697_C4", "label": "for offset, el", "type": "for", "loc": [697, 699], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "vector": [6, 2, 0.7852, 0.0034, 2, 0.84, 0.75, 699, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "offset, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for offset, el in parent._elements.items():\n if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:\n return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L698_C6", "label": "if", "type": "if", "loc": [698, 699], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L697_C4", "vector": [4, 3, 0.7857, 0.0022, 3, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:\n return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L699_C8", "label": "return", "type": "return", "loc": [699, 699], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L698_C6", "vector": [13, 4, 0.7863, 0.0011, 4, 0.21, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L700_C4", "label": "return", "type": "return", "loc": [700, 700], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "vector": [13, 2, 0.7874, 0.0011, 2, 0.84, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2", "label": "is_root", "type": "function", "loc": [702, 704], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7908, 0.0034, 1, 0.64, 0.4118, 748, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_root", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_root(self):\n \"\"\"Returns whether this is the root blip of a wavelet.\"\"\"\n return self._parent_blip_id is None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L703_C4", "label": "expression", "type": "expression", "loc": [703, 703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2", "vector": [8, 2, 0.7908, 0.0011, 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 whether this is the root blip of a wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L704_C4", "label": "return", "type": "return", "loc": [704, 704], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2", "vector": [13, 2, 0.7919, 0.0011, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._parent_blip_id is None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2", "label": "annotations", "type": "function", "loc": [707, 709], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.7964, 0.0034, 1, 0.64, 0.4412, 398, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "annotations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def annotations(self):\n \"\"\"The annotations for this document.\"\"\"\n return self._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L708_C4", "label": "expression", "type": "expression", "loc": [708, 708], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2", "vector": [8, 2, 0.7964, 0.0011, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The annotations for this document.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L709_C4", "label": "return", "type": "return", "loc": [709, 709], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2", "vector": [13, 2, 0.7975, 0.0011, 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._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2", "label": "elements", "type": "function", "loc": [712, 720], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8054, 0.0101, 1, 0.64, 0.4706, 915, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "elements", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def elements(self):\n \"\"\"Returns a list of elements for this document.\n The elements of a blip are things like forms elements and gadgets\n that cannot be expressed as plain text. In the text of the blip, you'll\n typically find a space as a place holder for the element.\n If you want to retrieve the element at a particular index in the blip, use\n blip[index].value().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L713_C4", "label": "expression", "type": "expression", "loc": [713, 719], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2", "vector": [8, 2, 0.8054, 0.0079, 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 a list of elements for this document.\n The elements of a blip are things like forms elements and gadgets\n that cannot be expressed as plain text. In the text of the blip, you'll\n typically find a space as a place holder for the element.\n If you want to retrieve the element at a particular index in the blip, use\n blip[index].value().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L720_C4", "label": "return", "type": "return", "loc": [720, 720], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2", "vector": [13, 2, 0.8099, 0.0011, 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._elements.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L722_C2", "label": "__len__", "type": "function", "loc": [722, 723], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8127, 0.0022, 1, 0.64, 0.5, 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 return len(self._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L723_C4", "label": "return", "type": "return", "loc": [723, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L722_C2", "vector": [13, 2, 0.8133, 0.0011, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2", "label": "__getitem__", "type": "function", "loc": [725, 732], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8195, 0.009, 1, 0.64, 0.5294, 698, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getitem__", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, item):\n \"\"\"returns a BlipRefs for the given slice.\"\"\"\n if isinstance(item, slice):\n if item.step:\n raise errors.Error('Step not supported for blip slices')\n return self.range(item.start, item.stop)\n else:\n return self.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L726_C4", "label": "expression", "type": "expression", "loc": [726, 726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2", "vector": [8, 2, 0.8166, 0.0011, 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 a BlipRefs for the given slice.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "label": "if", "type": "if", "loc": [727, 732], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2", "vector": [4, 2, 0.8206, 0.0067, 2, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, slice):\n if item.step:\n raise errors.Error('Step not supported for blip slices')\n return self.range(item.start, item.stop)\n else:\n return self.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L728_C6", "label": "if", "type": "if", "loc": [728, 729], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "vector": [4, 3, 0.8195, 0.0022, 3, 0.78, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item.step:\n raise errors.Error('Step not supported for blip slices')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L730_C6", "label": "return", "type": "return", "loc": [730, 730], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "vector": [13, 3, 0.8211, 0.0011, 3, 0.78, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.range(item.start, item.stop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L732_C6", "label": "return", "type": "return", "loc": [732, 732], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "vector": [13, 3, 0.8234, 0.0011, 3, 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.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2", "label": "__setitem__", "type": "function", "loc": [734, 736], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8268, 0.0034, 1, 0.64, 0.5588, 343, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__setitem__", "arg_names": ["self", "item", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, item, value):\n \"\"\"short cut for self.range/at().replace(value).\"\"\"\n self.__getitem__(item).replace(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L735_C4", "label": "expression", "type": "expression", "loc": [735, 735], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2", "vector": [8, 2, 0.8268, 0.0011, 2, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"short cut for self.range/at().replace(value).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L736_C4", "label": "replace()", "type": "expression", "loc": [736, 736], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2", "vector": [8, 2, 0.8279, 0.0011, 2, 0.06, 1.0, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " self.__getitem__(item).replace(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2", "label": "__delitem__", "type": "function", "loc": [738, 740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8313, 0.0034, 1, 0.64, 0.5882, 66, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__delitem__", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, item):\n \"\"\"short cut for self.range/at().delete().\"\"\"\n self.__getitem__(item).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L739_C4", "label": "expression", "type": "expression", "loc": [739, 739], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2", "vector": [8, 2, 0.8313, 0.0011, 2, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"short cut for self.range/at().delete().\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L740_C4", "label": "delete()", "type": "expression", "loc": [740, 740], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2", "vector": [8, 2, 0.8324, 0.0011, 2, 0.81, 1.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.__getitem__(item).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "label": "_shift", "type": "function", "loc": [742, 750], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8391, 0.0101, 1, 0.64, 0.6176, 613, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Move element and annotations after 'where' up by 'inc'.\"\"\"\n new_elements = {}\n for idx, el in self._elements.items():\n if idx >= where:\n idx += inc\n new_elements[idx] = el\n self._elements = new_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L743_C4", "label": "expression", "type": "expression", "loc": [743, 743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "vector": [8, 2, 0.8358, 0.0011, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Move element and annotations after 'where' up by 'inc'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L744_C4", "label": "new_elements =", "type": "assigned_variable", "loc": [744, 744], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "vector": [14, 2, 0.8369, 0.0011, 2, 0.64, 0.25, 700, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "new_elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_elements = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4", "label": "for idx, el", "type": "for", "loc": [745, 748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "vector": [6, 2, 0.8397, 0.0045, 2, 0.64, 0.5, 946, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, el in self._elements.items():\n if idx >= where:\n idx += inc\n new_elements[idx] = el"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L746_C6", "label": "if", "type": "if", "loc": [746, 747], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4", "vector": [4, 3, 0.8397, 0.0022, 3, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if idx >= where:\n idx += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L748_C6", "label": "assign", "type": "assigned_variable", "loc": [748, 748], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4", "vector": [14, 3, 0.8414, 0.0011, 3, 0.91, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_elements[idx] = el"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L749_C4", "label": "self._elements =", "type": "assigned_variable", "loc": [749, 749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "vector": [14, 2, 0.8425, 0.0011, 2, 0.64, 0.75, 809, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._elements = new_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L750_C4", "label": "_shift()", "type": "expression", "loc": [750, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "vector": [8, 2, 0.8436, 0.0011, 2, 0.64, 1.0, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " self._annotations._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2", "label": "_delete_annotations", "type": "function", "loc": [752, 755], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8476, 0.0045, 1, 0.64, 0.6471, 741, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_annotations", "arg_names": ["self", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_annotations(self, start, end):\n \"\"\"Delete all annotations between 'start' and 'end'.\"\"\"\n for annotation_name in self._annotations.names():\n self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L753_C4", "label": "expression", "type": "expression", "loc": [753, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2", "vector": [8, 2, 0.847, 0.0011, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete all annotations between 'start' and 'end'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L754_C4", "label": "for annotation_name", "type": "for", "loc": [754, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2", "vector": [6, 2, 0.8487, 0.0022, 2, 0.48, 1.0, 600, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annotation_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotation_name in self._annotations.names():\n self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L755_C6", "label": "_delete_internal()", "type": "expression", "loc": [755, 755], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L754_C4", "vector": [8, 3, 0.8493, 0.0011, 3, 0.18, 0.0, 221, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_internal", "annotation": ""}, "snippet": " self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2", "label": "all", "type": "function", "loc": [757, 762], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8543, 0.0067, 1, 0.64, 0.6765, 895, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "all", "arg_names": ["self", "findwhat", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def all(self, findwhat=None, maxres=-1, **restrictions):\n \"\"\"Returns a BlipRefs object representing all results for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\"\n return BlipRefs.all(self, findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L758_C4", "label": "expression", "type": "expression", "loc": [758, 761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2", "vector": [8, 2, 0.8543, 0.0045, 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 a BlipRefs object representing all results for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L762_C4", "label": "return", "type": "return", "loc": [762, 762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2", "vector": [13, 2, 0.8571, 0.0011, 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 BlipRefs.all(self, findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2", "label": "first", "type": "function", "loc": [764, 769], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8622, 0.0067, 1, 0.64, 0.7059, 199, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "first", "arg_names": ["self", "findwhat", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def first(self, findwhat=None, **restrictions):\n \"\"\"Returns a BlipRefs object representing the first result for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\"\n return BlipRefs.all(self, findwhat, 1, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L765_C4", "label": "expression", "type": "expression", "loc": [765, 768], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2", "vector": [8, 2, 0.8622, 0.0045, 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 a BlipRefs object representing the first result for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L769_C4", "label": "return", "type": "return", "loc": [769, 769], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2", "vector": [13, 2, 0.865, 0.0011, 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 BlipRefs.all(self, findwhat, 1, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2", "label": "at", "type": "function", "loc": [771, 773], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8684, 0.0034, 1, 0.64, 0.7353, 296, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "at", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def at(self, index):\n \"\"\"Returns a BlipRefs object representing a 1-character range.\"\"\"\n return BlipRefs.range(self, index, index + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L772_C4", "label": "expression", "type": "expression", "loc": [772, 772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2", "vector": [8, 2, 0.8684, 0.0011, 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 a BlipRefs object representing a 1-character range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L773_C4", "label": "return", "type": "return", "loc": [773, 773], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2", "vector": [13, 2, 0.8695, 0.0011, 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 BlipRefs.range(self, index, index + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2", "label": "range", "type": "function", "loc": [775, 777], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8729, 0.0034, 1, 0.64, 0.7647, 816, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "range", "arg_names": ["self", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def range(self, start, end):\n \"\"\"Returns a BlipRefs object representing the range.\"\"\"\n return BlipRefs.range(self, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L776_C4", "label": "expression", "type": "expression", "loc": [776, 776], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2", "vector": [8, 2, 0.8729, 0.0011, 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 a BlipRefs object representing the range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L777_C4", "label": "return", "type": "return", "loc": [777, 777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2", "vector": [13, 2, 0.874, 0.0011, 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 BlipRefs.range(self, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2", "label": "serialize", "type": "function", "loc": [779, 794], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.8847, 0.018, 1, 0.64, 0.7941, 50, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a dictionary representation of this blip ready for json.\"\"\"\n return {'blipId': self._blip_id,\n 'childBlipIds': list(self._child_blip_ids),\n 'content': self._content,\n 'creator': self._creator,\n 'contributors': list(self._contributors),\n 'lastModifiedTime': self._last_modified_time,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L780_C4", "label": "expression", "type": "expression", "loc": [780, 780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2", "vector": [8, 2, 0.8774, 0.0011, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a dictionary representation of this blip ready for json.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L781_C4", "label": "return", "type": "return", "loc": [781, 794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2", "vector": [13, 2, 0.8858, 0.0157, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 6, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'blipId': self._blip_id,\n 'childBlipIds': list(self._child_blip_ids),\n 'content': self._content,\n 'creator': self._creator,\n 'contributors': list(self._contributors),\n 'lastModifiedTime': self._last_modified_time,\n 'version': self._version,\n 'parentBlipId': self._parent_blip_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "label": "proxy_for", "type": "function", "loc": [796, 822], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.91, 0.0304, 1, 0.64, 0.8235, 365, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy_for_id):\n \"\"\"Return a view on this blip that will proxy for the specified id.\n\n A shallow copy of the current blip is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L797_C4", "label": "expression", "type": "expression", "loc": [797, 803], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [8, 2, 0.8999, 0.0079, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a view on this blip that will proxy for the specified id.\n\n A shallow copy of the current blip is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L804_C4", "label": "operation_queue = proxy_for()", "type": "assigned_variable", "loc": [804, 804], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9044, 0.0011, 2, 0.64, 0.0588, 919, 3, 1, 0, 0, 365, 10, 1], "semantic": {"name": "operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "proxy_for", "annotation": ""}, "snippet": " operation_queue = self._operation_queue.proxy_for(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L805_C4", "label": "res = Blip()", "type": "assigned_variable", "loc": [805, 807], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9066, 0.0034, 2, 0.64, 0.1176, 413, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " res = Blip(json={},\n other_blips={},\n operation_queue=operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L808_C4", "label": "res._blip_id =", "type": "assigned_variable", "loc": [808, 808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9089, 0.0011, 2, 0.64, 0.1765, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._blip_id = self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L809_C4", "label": "res._child_blip_ids =", "type": "assigned_variable", "loc": [809, 809], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.91, 0.0011, 2, 0.64, 0.2353, 713, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._child_blip_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._child_blip_ids = self._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L810_C4", "label": "res._content =", "type": "assigned_variable", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9111, 0.0011, 2, 0.64, 0.2941, 79, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._content = self._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L811_C4", "label": "res._contributors =", "type": "assigned_variable", "loc": [811, 811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9123, 0.0011, 2, 0.64, 0.3529, 874, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._contributors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._contributors = self._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L812_C4", "label": "res._creator =", "type": "assigned_variable", "loc": [812, 812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9134, 0.0011, 2, 0.64, 0.4118, 937, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creator = self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L813_C4", "label": "res._last_modified_time =", "type": "assigned_variable", "loc": [813, 813], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9145, 0.0011, 2, 0.64, 0.4706, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._last_modified_time = self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L814_C4", "label": "res._version =", "type": "assigned_variable", "loc": [814, 814], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9156, 0.0011, 2, 0.64, 0.5294, 547, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._version = self._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L815_C4", "label": "res._parent_blip_id =", "type": "assigned_variable", "loc": [815, 815], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9168, 0.0011, 2, 0.64, 0.5882, 545, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._parent_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._parent_blip_id = self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L816_C4", "label": "res._wave_id =", "type": "assigned_variable", "loc": [816, 816], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9179, 0.0011, 2, 0.64, 0.6471, 620, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wave_id = self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L817_C4", "label": "res._wavelet_id =", "type": "assigned_variable", "loc": [817, 817], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.919, 0.0011, 2, 0.64, 0.7059, 917, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wavelet_id = self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L818_C4", "label": "res._other_blips =", "type": "assigned_variable", "loc": [818, 818], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9201, 0.0011, 2, 0.64, 0.7647, 755, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._other_blips = self._other_blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L819_C4", "label": "res._annotations =", "type": "assigned_variable", "loc": [819, 819], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9213, 0.0011, 2, 0.64, 0.8235, 378, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._annotations = self._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L820_C4", "label": "res._elements =", "type": "assigned_variable", "loc": [820, 820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9224, 0.0011, 2, 0.64, 0.8824, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._elements = self._elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L821_C4", "label": "res.raw_data =", "type": "assigned_variable", "loc": [821, 821], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [14, 2, 0.9235, 0.0011, 2, 0.64, 0.9412, 278, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res.raw_data = self.raw_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L822_C4", "label": "return", "type": "return", "loc": [822, 822], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "vector": [13, 2, 0.9246, 0.0011, 2, 0.64, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2", "label": "text", "type": "function", "loc": [825, 827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9291, 0.0034, 1, 0.64, 0.8529, 439, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def text(self):\n \"\"\"Returns the raw text content of this document.\"\"\"\n return self._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L826_C4", "label": "expression", "type": "expression", "loc": [826, 826], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2", "vector": [8, 2, 0.9291, 0.0011, 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 raw text content of this document.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L827_C4", "label": "return", "type": "return", "loc": [827, 827], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2", "vector": [13, 2, 0.9303, 0.0011, 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._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "label": "find", "type": "function", "loc": [829, 840], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9387, 0.0135, 1, 0.64, 0.8824, 340, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "find", "arg_names": ["self", "what", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def find(self, what, **restrictions):\n \"\"\"Iterate to matching bits of contents.\n\n Yield either elements or pieces of text.\n \"\"\"\n br = BlipRefs.all(self, what, **restrictions)\n for start, end in br._hits():\n if end - start == 1 and start in self._elements:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L830_C4", "label": "expression", "type": "expression", "loc": [830, 833], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "vector": [8, 2, 0.9353, 0.0045, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Iterate to matching bits of contents.\n\n Yield either elements or pieces of text.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L834_C4", "label": "br = all()", "type": "assigned_variable", "loc": [834, 834], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "vector": [14, 2, 0.9381, 0.0011, 2, 0.0, 0.5, 199, 3, 3, 0, 0, 895, 10, 1], "semantic": {"name": "br", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " br = BlipRefs.all(self, what, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L835_C4", "label": "for start, end", "type": "for", "loc": [835, 839], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "vector": [6, 2, 0.9415, 0.0056, 2, 0.0, 1.0, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in br._hits():\n if end - start == 1 and start in self._elements:\n yield self._elements[start]\n else:\n yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6", "label": "if", "type": "if", "loc": [836, 839], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L835_C4", "vector": [4, 3, 0.9421, 0.0045, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end - start == 1 and start in self._elements:\n yield self._elements[start]\n else:\n yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L837_C8", "label": "expression", "type": "expression", "loc": [837, 837], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6", "vector": [8, 4, 0.9415, 0.0011, 4, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._elements[start]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L839_C8", "label": "expression", "type": "expression", "loc": [839, 839], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6", "vector": [8, 4, 0.9438, 0.0011, 4, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2", "label": "append", "type": "function", "loc": [842, 845], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9488, 0.0045, 1, 0.64, 0.9118, 243, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, what, bundled_annotations=None):\n \"\"\"Convenience method covering a common pattern.\"\"\"\n return BlipRefs.all(self, findwhat=None).insert_after(\n what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L843_C4", "label": "expression", "type": "expression", "loc": [843, 843], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2", "vector": [8, 2, 0.9483, 0.0011, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convenience method covering a common pattern.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L844_C4", "label": "return", "type": "return", "loc": [844, 845], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2", "vector": [13, 2, 0.9499, 0.0022, 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 BlipRefs.all(self, findwhat=None).insert_after(\n what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "label": "reply", "type": "function", "loc": [847, 854], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9567, 0.009, 1, 0.64, 0.9412, 714, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "reply", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reply(self):\n \"\"\"Create and return a reply to this blip.\"\"\"\n blip_data = self._operation_queue.blip_create_child(self.wave_id,\n self.wavelet_id,\n self.blip_id)\n new_blip = Blip(blip_data, self._other_blips, self._operation_queue)\n self._other_blips._add(new_blip)\n return new_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L848_C4", "label": "expression", "type": "expression", "loc": [848, 848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "vector": [8, 2, 0.9539, 0.0011, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create and return a reply to this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L849_C4", "label": "blip_data = blip_create_child()", "type": "assigned_variable", "loc": [849, 851], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "vector": [14, 2, 0.9561, 0.0034, 2, 0.99, 0.25, 892, 3, 3, 0, 0, 643, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "blip_create_child", "annotation": ""}, "snippet": " blip_data = self._operation_queue.blip_create_child(self.wave_id,\n self.wavelet_id,\n self.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L852_C4", "label": "new_blip = Blip()", "type": "assigned_variable", "loc": [852, 852], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "vector": [14, 2, 0.9584, 0.0011, 2, 0.99, 0.5, 893, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " new_blip = Blip(blip_data, self._other_blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L853_C4", "label": "_add()", "type": "expression", "loc": [853, 853], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "vector": [8, 2, 0.9595, 0.0011, 2, 0.99, 0.75, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._other_blips._add(new_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L854_C4", "label": "return", "type": "return", "loc": [854, 854], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "vector": [13, 2, 0.9606, 0.0011, 2, 0.99, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "label": "append_markup", "type": "function", "loc": [856, 867], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9691, 0.0135, 1, 0.64, 0.9706, 513, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "append_markup", "arg_names": ["self", "markup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append_markup(self, markup):\n \"\"\"Interpret the markup text as xhtml and append the result to the doc.\n\n Args:\n markup: The markup'ed text to append.\n \"\"\"\n markup = util.force_unicode(markup)\n self._operation_queue.document_append_markup(self.wave_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L857_C4", "label": "expression", "type": "expression", "loc": [857, 861], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "vector": [8, 2, 0.9663, 0.0056, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Interpret the markup text as xhtml and append the result to the doc.\n\n Args:\n markup: The markup'ed text to append.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L862_C4", "label": "markup = force_unicode()", "type": "assigned_variable", "loc": [862, 862], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "vector": [14, 2, 0.9696, 0.0011, 2, 0.99, 0.5, 922, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "markup", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " markup = util.force_unicode(markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L863_C4", "label": "document_append_markup()", "type": "expression", "loc": [863, 866], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "vector": [8, 2, 0.9724, 0.0045, 2, 0.99, 1.0, 684, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "document_append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "document_append_markup", "annotation": ""}, "snippet": " self._operation_queue.document_append_markup(self.wave_id,\n self.wavelet_id,\n self.blip_id,\n markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "label": "insert_inline_blip", "type": "function", "loc": [869, 889], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "vector": [2, 1, 0.9888, 0.0236, 1, 0.64, 1.0, 203, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "insert_inline_blip", "arg_names": ["self", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert_inline_blip(self, position):\n \"\"\"Inserts an inline blip into this blip at a specific position.\n\n Args:\n position: Position to insert the blip at. This has to be greater than 0.\n\n Returns:\n The JSON data of the blip that was created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L870_C4", "label": "expression", "type": "expression", "loc": [870, 877], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [8, 2, 0.9826, 0.009, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts an inline blip into this blip at a specific position.\n\n Args:\n position: Position to insert the blip at. This has to be greater than 0.\n\n Returns:\n The JSON data of the blip that was created.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L878_C4", "label": "if", "type": "if", "loc": [878, 880], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [4, 2, 0.9888, 0.0034, 2, 0.93, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if position <= 0:\n raise IndexError(('Illegal inline blip position: %d. Position has to ' +\n 'be greater than 0.') % position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L882_C4", "label": "blip_data = document_inline_blip_insert()", "type": "assigned_variable", "loc": [882, 886], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [14, 2, 0.9944, 0.0056, 2, 0.93, 0.4, 892, 3, 4, 0, 0, 243, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "document_inline_blip_insert", "annotation": ""}, "snippet": " blip_data = self._operation_queue.document_inline_blip_insert(\n self.wave_id,\n self.wavelet_id,\n self.blip_id,\n position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L887_C4", "label": "new_blip = Blip()", "type": "assigned_variable", "loc": [887, 887], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [14, 2, 0.9978, 0.0011, 2, 0.93, 0.6, 893, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " new_blip = Blip(blip_data, self._other_blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L888_C4", "label": "_add()", "type": "expression", "loc": [888, 888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [8, 2, 0.9989, 0.0011, 2, 0.93, 0.8, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._other_blips._add(new_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L889_C4", "label": "return", "type": "return", "loc": [889, 889], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "vector": [13, 2, 1.0, 0.0011, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_blip"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L68_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L107_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L108_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L110_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L119_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L122_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L124_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L125_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L127_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L132_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L134_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L138_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L144_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L146_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L148_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L155_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L155_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L161_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L171_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L175_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L175_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L179_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L181_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L181_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L184_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L184_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L187_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L189_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L189_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L192_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L207_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L207_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L213_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L213_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L216_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L219_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L226_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L227_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L227_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L231_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L247_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L252_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L265_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L266_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L268_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L269_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L270_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L271_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L286_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L288_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L294_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L309_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L311_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L311_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L336_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L339_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L340_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L348_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L349_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L349_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L351_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L353_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L377_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L377_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L379_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L388_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L391_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L392_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L392_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L396_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L398_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L401_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L405_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L412_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L413_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L415_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L416_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L417_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L418_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L420_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L421_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L423_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L425_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L426_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L429_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L431_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L431_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L434_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L436_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L438_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L443_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L450_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L450_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L451_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L453_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L454_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L456_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L457_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L458_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L458_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L459_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L461_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L461_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L462_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L466_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L471_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L472_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L475_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L475_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L478_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L477_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L482_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L482_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L484_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L484_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L486_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L488_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L490_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L491_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L493_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L494_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L495_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L501_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L501_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L502_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L501_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L507_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L506_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L508_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L511_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L517_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L516_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L528_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L527_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L530_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L533_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L542_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L544_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L547_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L547_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L547_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L549_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L551_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L550_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L557_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L556_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L569_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L568_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L572_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L574_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L576_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L576_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L577_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L577_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L578_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L582_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L593_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L602_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L603_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L606_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L607_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L609_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L610_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L612_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L614_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L616_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L619_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L620_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L624_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L627_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L628_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L631_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L636_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L638_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L641_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L643_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L646_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L648_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L652_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L651_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L653_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L658_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L657_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L659_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L663_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L662_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L668_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L667_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L673_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L672_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L674_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L677_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L679_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L683_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L682_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L685_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L689_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L694_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L696_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L697_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L697_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L698_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L698_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L700_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L703_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L702_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L704_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L708_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L707_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L709_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L713_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L712_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L720_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L722_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L722_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L723_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L726_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L725_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L728_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L730_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L732_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L735_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L734_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L736_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L739_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L738_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L740_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L743_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L744_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L746_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L748_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L749_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L750_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L753_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L752_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L754_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L754_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L755_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L758_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L757_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L762_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L765_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L764_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L772_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L771_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L773_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L776_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L775_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L777_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L780_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L779_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L781_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L804_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L805_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L808_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L809_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L810_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L811_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L812_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L813_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L815_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L816_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L817_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L818_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L820_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L821_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L822_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L826_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L825_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L827_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L830_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L834_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L835_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:For_L835_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L837_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L836_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L839_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L843_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L842_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L844_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L848_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L849_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L852_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L853_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L854_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L857_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L862_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L863_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L870_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:If_L878_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L882_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Assign_L887_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Expr_L888_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1112:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1112:Return_L889_C4"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the robot module."""
import unittest
import events
import ops
import robot
import simplejson
BLIP_JSON = ('{"wdykLROk*13":'
'{"lastModifiedTime":1242079608457,'
'"contributors":["someguy@test.com"],'
'"waveletId":"test.com!conv+root",'
'"waveId":"test.com!wdykLROk*11",'
'"parentBlipId":null,'
'"version":3,'
'"creator":"someguy@test.com",'
'"content":"\\nContent!",'
'"blipId":"wdykLROk*13","'
'annotations":[{"range":{"start":0,"end":1},'
'"name":"user/e/davidbyttow@google.com","value":"David"}],'
'"elements":{},'
'"childBlipIds":[]}'
'}')
WAVELET_JSON = ('{"lastModifiedTime":1242079611003,'
'"title":"A title",'
'"waveletId":"test.com!conv+root",'
'"rootBlipId":"wdykLROk*13",'
'"dataDocuments":null,'
'"creationTime":1242079608457,'
'"waveId":"test.com!wdykLROk*11",'
'"participants":["someguy@test.com","monty@appspot.com"],'
'"creator":"someguy@test.com",'
'"version":5}')
EVENTS_JSON = ('[{"timestamp":1242079611003,'
'"modifiedBy":"someguy@test.com",'
'"properties":{"participantsRemoved":[],'
'"participantsAdded":["monty@appspot.com"]},'
'"type":"WAVELET_PARTICIPANTS_CHANGED"}]')
TEST_JSON = '{"blips":%s,"wavelet":%s,"events":%s}' % (
BLIP_JSON, WAVELET_JSON, EVENTS_JSON)
NEW_WAVE_JSON = [{"data":
{"waveletId": "wavesandbox.com!conv+root",
"blipId": "b+LrODcLZkDlu", "waveId":
"wavesandbox.com!w+LrODcLZkDlt"},
"id": "op2"}]
NEW_WAVE_JSON_OLD = [{'data':
[{'data':
{'waveletId': 'googlewave.com!conv+root',
'blipId': 'b+VqQXQbZkCP1',
'waveId': 'googlewave.com!w+VqQXQbZkCP0'},
'id': 'wavelet.create1265055048410'}],
'id': 'op10'}];
class TestRobot(unittest.TestCase):
"""Tests for testing the basic parsing of json in robots."""
def setUp(self):
self.robot = robot.Robot('Testy')
def testCreateWave(self):
self.robot.submit = lambda x: NEW_WAVE_JSON
new_wave = self.robot.new_wave('wavesandbox.com', submit=True)
self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)
self.robot.submit = lambda x: NEW_WAVE_JSON_OLD
new_wave = self.robot.new_wave('googlewave.com', submit=True)
self.assertEqual('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)
def testEventParsing(self):
def check(event, wavelet):
# Test some basic properties; the rest should be covered by
# ops.CreateContext.
root = wavelet.root_blip
self.assertEqual(1, len(wavelet.blips))
self.assertEqual('wdykLROk*13', root.blip_id)
self.assertEqual('test.com!wdykLROk*11', root.wave_id)
self.assertEqual('test.com!conv+root', root.wavelet_id)
self.assertEqual('WAVELET_PARTICIPANTS_CHANGED', event.type)
self.assertEqual({'participantsRemoved': [],
'participantsAdded': ['monty@appspot.com']},
event.properties)
self.robot.test_called = True
self.robot.test_called = False
self.robot.register_handler(events.WaveletParticipantsChanged,
check)
json = self.robot.process_events(TEST_JSON)
self.assertTrue(self.robot.test_called)
operations = simplejson.loads(json)
# there should be one operation indicating the current version:
self.assertEqual(1, len(operations))
def testWrongEventsIgnored(self):
self.robot.test_called = True
def check(event, wavelet):
called = True
self.robot.test_called = False
self.robot.register_handler(events.BlipSubmitted,
check)
self.robot.process_events(TEST_JSON)
self.assertFalse(self.robot.test_called)
def testOperationParsing(self):
def check(event, wavelet):
wavelet.reply()
wavelet.title = 'new title'
wavelet.root_blip.append_markup('<b>Hello</b>')
self.robot.register_handler(events.WaveletParticipantsChanged,
check)
json = self.robot.process_events(TEST_JSON)
operations = simplejson.loads(json)
expected = set([ops.ROBOT_NOTIFY_CAPABILITIES_HASH,
ops.WAVELET_APPEND_BLIP,
ops.WAVELET_SET_TITLE,
ops.DOCUMENT_APPEND_MARKUP])
methods = [operation['method'] for operation in operations]
for method in methods:
self.assertTrue(method in expected)
expected.remove(method)
self.assertEquals(0, len(expected))
def testSerializeWavelets(self):
wavelet = self.robot.blind_wavelet(TEST_JSON)
serialized = wavelet.serialize()
unserialized = self.robot.blind_wavelet(serialized)
self.assertEquals(wavelet.creator, unserialized.creator)
self.assertEquals(wavelet.creation_time, unserialized.creation_time)
self.assertEquals(wavelet.last_modified_time,
unserialized.last_modified_time)
self.assertEquals(wavelet.root_blip.blip_id, unserialized.root_blip.blip_id)
self.assertEquals(wavelet.title, unserialized.title)
self.assertEquals(wavelet.wave_id, unserialized.wave_id)
self.assertEquals(wavelet.wavelet_id, unserialized.wavelet_id)
self.assertEquals(wavelet.domain, unserialized.domain)
def testProxiedBlindWavelet(self):
def handler(event, wavelet):
blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')
blind_wavelet.reply()
blind_wavelet.submit_with(wavelet)
self.robot.register_handler(events.WaveletParticipantsChanged, handler)
json = self.robot.process_events(TEST_JSON)
operations = simplejson.loads(json)
self.assertEqual(2, len(operations))
self.assertEquals(ops.ROBOT_NOTIFY_CAPABILITIES_HASH,
operations[0]['method'])
self.assertEquals(ops.WAVELET_APPEND_BLIP, operations[1]['method'])
self.assertEquals('proxyid', operations[1]['params']['proxyingFor'])
def testCapabilitiesHashIncludesContextAndFilter(self):
robot1 = robot.Robot('Robot1')
robot1.register_handler(events.WaveletSelfAdded, lambda: '')
robot2 = robot.Robot('Robot2')
robot2.register_handler(events.WaveletSelfAdded, lambda: '',
context=events.Context.ALL)
self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())
robot3 = robot.Robot('Robot3')
robot2.register_handler(events.WaveletSelfAdded, lambda: '',
context=events.Context.ALL, filter="foo")
self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())
self.assertNotEqual(robot1.capabilities_hash(), robot3.capabilities_hash())
self.assertNotEqual(robot2.capabilities_hash(), robot3.capabilities_hash())
class TestGetCapabilitiesXml(unittest.TestCase):
def setUp(self):
self.robot = robot.Robot('Testy')
self.robot.capabilities_hash = lambda: '1'
def assertStringsEqual(self, s1, s2):
self.assertEqual(s1, s2, 'Strings differ:\n%s--\n%s' % (s1, s2))
def testDefault(self):
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testUrls(self):
profile_robot = robot.Robot(
'Testy',
image_url='http://example.com/image.png',
profile_url='http://example.com/profile.xml')
profile_robot.capabilities_hash = lambda: '1'
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = profile_robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testConsumerKey(self):
# setup_oauth doesn't work during testing, so heavy handed setting of
# properties it is:
self.robot._consumer_key = 'consumer'
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:consumer_key>consumer</w:consumer_key>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testCapsAndEvents(self):
self.robot.register_handler(events.BlipSubmitted, None,
context=[events.Context.SELF,
events.Context.ROOT])
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n'
' <w:capability name="%s" context="SELF,ROOT"/>\n'
'</w:capabilities>\n'
'</w:robot>\n') % (ops.PROTOCOL_VERSION, events.BlipSubmitted.type)
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1113 | 124 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0651, 0.0038, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the robot module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Import_L19_C0", "label": "unittest import unittest", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0728, 0.0038, 0, 0.66, 0.0714, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Import_L21_C0", "label": "events import events", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0805, 0.0038, 0, 0.66, 0.1429, 830, 0, 1, 0, 0, 830, 0, 0], "semantic": {"name": "events", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Import_L22_C0", "label": "ops import ops", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0843, 0.0038, 0, 0.66, 0.2143, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Import_L23_C0", "label": "robot import robot", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0881, 0.0038, 0, 0.66, 0.2857, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "robot", "arg_names": [], "import_names": ["robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Import_L24_C0", "label": "simplejson import simplejson", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.092, 0.0038, 0, 0.66, 0.3571, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L26_C0", "label": "BLIP_JSON =", "type": "assigned_variable", "loc": [26, 40], "level": 0, "parent": null, "vector": [14, 0, 0.1264, 0.0575, 0, 0.66, 0.4286, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_JSON = ('{\"wdykLROk*13\":'\n '{\"lastModifiedTime\":1242079608457,'\n '\"contributors\":[\"someguy@test.com\"],'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"parentBlipId\":null,'\n '\"version\":3,'\n '\"creator\":\"someguy@test.com\",'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L42_C0", "label": "WAVELET_JSON =", "type": "assigned_variable", "loc": [42, 51], "level": 0, "parent": null, "vector": [14, 0, 0.1782, 0.0383, 0, 0.66, 0.5, 26, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_JSON = ('{\"lastModifiedTime\":1242079611003,'\n '\"title\":\"A title\",'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"rootBlipId\":\"wdykLROk*13\",'\n '\"dataDocuments\":null,'\n '\"creationTime\":1242079608457,'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"participants\":[\"someguy@test.com\",\"monty@appspot.com\"],'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L53_C0", "label": "EVENTS_JSON =", "type": "assigned_variable", "loc": [53, 57], "level": 0, "parent": null, "vector": [14, 0, 0.2107, 0.0192, 0, 0.66, 0.5714, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "EVENTS_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EVENTS_JSON = ('[{\"timestamp\":1242079611003,'\n '\"modifiedBy\":\"someguy@test.com\",'\n '\"properties\":{\"participantsRemoved\":[],'\n '\"participantsAdded\":[\"monty@appspot.com\"]},'\n '\"type\":\"WAVELET_PARTICIPANTS_CHANGED\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L59_C0", "label": "TEST_JSON =", "type": "assigned_variable", "loc": [59, 60], "level": 0, "parent": null, "vector": [14, 0, 0.228, 0.0077, 0, 0.66, 0.6429, 23, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEST_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_JSON = '{\"blips\":%s,\"wavelet\":%s,\"events\":%s}' % (\n BLIP_JSON, WAVELET_JSON, EVENTS_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L62_C0", "label": "NEW_WAVE_JSON =", "type": "assigned_variable", "loc": [62, 66], "level": 0, "parent": null, "vector": [14, 0, 0.2452, 0.0192, 0, 0.66, 0.7143, 945, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "NEW_WAVE_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NEW_WAVE_JSON = [{\"data\":\n {\"waveletId\": \"wavesandbox.com!conv+root\",\n \"blipId\": \"b+LrODcLZkDlu\", \"waveId\":\n \"wavesandbox.com!w+LrODcLZkDlt\"},\n \"id\": \"op2\"}]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L68_C0", "label": "NEW_WAVE_JSON_OLD =", "type": "assigned_variable", "loc": [68, 74], "level": 0, "parent": null, "vector": [14, 0, 0.272, 0.0268, 0, 0.66, 0.7857, 630, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "NEW_WAVE_JSON_OLD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NEW_WAVE_JSON_OLD = [{'data':\n [{'data':\n {'waveletId': 'googlewave.com!conv+root',\n 'blipId': 'b+VqQXQbZkCP1',\n 'waveId': 'googlewave.com!w+VqQXQbZkCP0'},\n 'id': 'wavelet.create1265055048410'}],\n 'id': 'op10'}];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "label": "TestRobot", "type": "class", "loc": [76, 190], "level": 0, "parent": null, "vector": [3, 0, 0.5096, 0.4406, 0, 0.66, 0.8571, 196, 0, 12, 0, 0, 878, 0, 71], "semantic": {"name": "TestRobot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestRobot(unittest.TestCase):\n \"\"\"Tests for testing the basic parsing of json in robots.\"\"\"\n\n def setUp(self):\n self.robot = robot.Robot('Testy')\n\n def testCreateWave(self):\n self.robot.submit = lambda x: NEW_WAVE_JSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L77_C2", "label": "expression", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [8, 1, 0.295, 0.0038, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests for testing the basic parsing of json in robots.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L79_C2", "label": "setUp", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.3046, 0.0077, 1, 0.9, 0.125, 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.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L80_C4", "label": "self.robot = Robot()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L79_C2", "vector": [14, 2, 0.3065, 0.0038, 2, 0.25, 0.0, 879, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "self.robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " self.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "label": "testCreateWave", "type": "function", "loc": [82, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.3257, 0.0268, 1, 0.9, 0.25, 958, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testCreateWave", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCreateWave(self):\n self.robot.submit = lambda x: NEW_WAVE_JSON\n new_wave = self.robot.new_wave('wavesandbox.com', submit=True)\n self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)\n self.robot.submit = lambda x: NEW_WAVE_JSON_OLD\n new_wave = self.robot.new_wave('googlewave.com', submit=True)\n self.assertEqual('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L83_C4", "label": "self.robot.submit =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [14, 2, 0.318, 0.0038, 2, 0.14, 0.0, 292, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.submit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.submit = lambda x: NEW_WAVE_JSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L84_C4", "label": "new_wave = new_wave()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [14, 2, 0.3218, 0.0038, 2, 0.14, 0.2, 669, 3, 2, 0, 0, 669, 10, 1], "semantic": {"name": "new_wave", "arg_names": [], "import_names": [], "rhs_call_name": "new_wave", "annotation": ""}, "snippet": " new_wave = self.robot.new_wave('wavesandbox.com', submit=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L85_C4", "label": "assertEqual()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [8, 2, 0.3257, 0.0038, 2, 0.14, 0.4, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L86_C4", "label": "self.robot.submit =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [14, 2, 0.3295, 0.0038, 2, 0.14, 0.6, 292, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.submit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.submit = lambda x: NEW_WAVE_JSON_OLD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L87_C4", "label": "new_wave = new_wave()", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [14, 2, 0.3333, 0.0038, 2, 0.14, 0.8, 669, 3, 2, 0, 0, 669, 10, 1], "semantic": {"name": "new_wave", "arg_names": [], "import_names": [], "rhs_call_name": "new_wave", "annotation": ""}, "snippet": " new_wave = self.robot.new_wave('googlewave.com', submit=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L88_C4", "label": "assertEqual()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "vector": [8, 2, 0.3372, 0.0038, 2, 0.14, 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('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "label": "testEventParsing", "type": "function", "loc": [90, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.387, 0.0881, 1, 0.9, 0.375, 777, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "testEventParsing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testEventParsing(self):\n def check(event, wavelet):\n # Test some basic properties; the rest should be covered by\n # ops.CreateContext.\n root = wavelet.root_blip\n self.assertEqual(1, len(wavelet.blips))\n self.assertEqual('wdykLROk*13', root.blip_id)\n self.assertEqual('test.com!wdykLROk*11', root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "label": "check", "type": "function", "loc": [91, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [2, 2, 0.3716, 0.0498, 2, 0.66, 0.0, 803, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n # Test some basic properties; the rest should be covered by\n # ops.CreateContext.\n root = wavelet.root_blip\n self.assertEqual(1, len(wavelet.blips))\n self.assertEqual('wdykLROk*13', root.blip_id)\n self.assertEqual('test.com!wdykLROk*11', root.wave_id)\n self.assertEqual('test.com!conv+root', root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L94_C6", "label": "root =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [14, 3, 0.3602, 0.0038, 3, 0.46, 0.0, 696, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " root = wavelet.root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L95_C6", "label": "assertEqual()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.364, 0.0038, 3, 0.46, 0.1429, 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(wavelet.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L96_C6", "label": "assertEqual()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.3678, 0.0038, 3, 0.46, 0.2857, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wdykLROk*13', root.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L97_C6", "label": "assertEqual()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.3716, 0.0038, 3, 0.46, 0.4286, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('test.com!wdykLROk*11', root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L98_C6", "label": "assertEqual()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.3755, 0.0038, 3, 0.46, 0.5714, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('test.com!conv+root', root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L99_C6", "label": "assertEqual()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.3793, 0.0038, 3, 0.46, 0.7143, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('WAVELET_PARTICIPANTS_CHANGED', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L100_C6", "label": "assertEqual()", "type": "expression", "loc": [100, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [8, 3, 0.387, 0.0115, 3, 0.46, 0.8571, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual({'participantsRemoved': [],\n 'participantsAdded': ['monty@appspot.com']},\n event.properties)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L103_C6", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "vector": [14, 3, 0.3946, 0.0038, 3, 0.46, 1.0, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L105_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [14, 2, 0.4023, 0.0038, 2, 0.66, 0.1667, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L106_C4", "label": "register_handler()", "type": "expression", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [8, 2, 0.408, 0.0077, 2, 0.66, 0.3333, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L108_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [14, 2, 0.4138, 0.0038, 2, 0.66, 0.5, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L109_C4", "label": "assertTrue()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [8, 2, 0.4176, 0.0038, 2, 0.66, 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.robot.test_called)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L110_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [14, 2, 0.4215, 0.0038, 2, 0.66, 0.8333, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L112_C4", "label": "assertEqual()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "vector": [8, 2, 0.4291, 0.0038, 2, 0.66, 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(1, len(operations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "label": "testWrongEventsIgnored", "type": "function", "loc": [114, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.4559, 0.0421, 1, 0.9, 0.5, 805, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testWrongEventsIgnored", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWrongEventsIgnored(self):\n self.robot.test_called = True\n\n def check(event, wavelet):\n called = True\n\n self.robot.test_called = False\n self.robot.register_handler(events.BlipSubmitted,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L115_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [14, 2, 0.4406, 0.0038, 2, 0.78, 0.0, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L117_C4", "label": "check", "type": "function", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [2, 2, 0.4502, 0.0077, 2, 0.78, 0.2, 803, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L118_C6", "label": "called =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L117_C4", "vector": [14, 3, 0.4521, 0.0038, 3, 0.84, 0.0, 30, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L120_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [14, 2, 0.4598, 0.0038, 2, 0.78, 0.4, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L121_C4", "label": "register_handler()", "type": "expression", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [8, 2, 0.4655, 0.0077, 2, 0.78, 0.6, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.BlipSubmitted,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L123_C4", "label": "process_events()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [8, 2, 0.4713, 0.0038, 2, 0.78, 0.8, 196, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_events", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L124_C4", "label": "assertFalse()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "vector": [8, 2, 0.4751, 0.0038, 2, 0.78, 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.robot.test_called)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "label": "testOperationParsing", "type": "function", "loc": [126, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.5172, 0.0728, 1, 0.9, 0.625, 642, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testOperationParsing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testOperationParsing(self):\n def check(event, wavelet):\n wavelet.reply()\n wavelet.title = 'new title'\n wavelet.root_blip.append_markup('<b>Hello</b>')\n\n self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "label": "check", "type": "function", "loc": [127, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [2, 2, 0.4923, 0.0153, 2, 0.08, 0.0, 803, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n wavelet.reply()\n wavelet.title = 'new title'\n wavelet.root_blip.append_markup('<b>Hello</b>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L128_C6", "label": "reply()", "type": "expression", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "vector": [8, 3, 0.4904, 0.0038, 3, 0.0, 0.0, 714, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L129_C6", "label": "wavelet.title =", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "vector": [14, 3, 0.4943, 0.0038, 3, 0.0, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet.title = 'new title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L130_C6", "label": "append_markup()", "type": "expression", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "vector": [8, 3, 0.4981, 0.0038, 3, 0.0, 1.0, 513, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "append_markup", "annotation": ""}, "snippet": " wavelet.root_blip.append_markup('<b>Hello</b>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L132_C4", "label": "register_handler()", "type": "expression", "loc": [132, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [8, 2, 0.5077, 0.0077, 2, 0.08, 0.1429, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L134_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [14, 2, 0.5134, 0.0038, 2, 0.08, 0.2857, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L135_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [14, 2, 0.5172, 0.0038, 2, 0.08, 0.4286, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L136_C4", "label": "expected = set()", "type": "assigned_variable", "loc": [136, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [14, 2, 0.5268, 0.0153, 2, 0.08, 0.5714, 361, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " expected = set([ops.ROBOT_NOTIFY_CAPABILITIES_HASH,\n ops.WAVELET_APPEND_BLIP,\n ops.WAVELET_SET_TITLE,\n ops.DOCUMENT_APPEND_MARKUP])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L140_C4", "label": "methods =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [14, 2, 0.5364, 0.0038, 2, 0.08, 0.7143, 110, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " methods = [operation['method'] for operation in operations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4", "label": "for method", "type": "for", "loc": [141, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [6, 2, 0.5441, 0.0115, 2, 0.08, 0.8571, 445, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for method in methods:\n self.assertTrue(method in expected)\n expected.remove(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L142_C6", "label": "assertTrue()", "type": "expression", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4", "vector": [8, 3, 0.5441, 0.0038, 3, 0.9, 0.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(method in expected)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L143_C6", "label": "remove()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4", "vector": [8, 3, 0.5479, 0.0038, 3, 0.9, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " expected.remove(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L144_C4", "label": "assertEquals()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "vector": [8, 2, 0.5517, 0.0038, 2, 0.08, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(expected))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "label": "testSerializeWavelets", "type": "function", "loc": [146, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.5824, 0.0498, 1, 0.9, 0.75, 970, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "testSerializeWavelets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeWavelets(self):\n wavelet = self.robot.blind_wavelet(TEST_JSON)\n serialized = wavelet.serialize()\n unserialized = self.robot.blind_wavelet(serialized)\n self.assertEquals(wavelet.creator, unserialized.creator)\n self.assertEquals(wavelet.creation_time, unserialized.creation_time)\n self.assertEquals(wavelet.last_modified_time,\n unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L147_C4", "label": "wavelet = blind_wavelet()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [14, 2, 0.5632, 0.0038, 2, 0.48, 0.0, 147, 3, 1, 0, 0, 652, 10, 1], "semantic": {"name": "wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " wavelet = self.robot.blind_wavelet(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L148_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [14, 2, 0.567, 0.0038, 2, 0.48, 0.1, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = wavelet.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L149_C4", "label": "unserialized = blind_wavelet()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [14, 2, 0.5709, 0.0038, 2, 0.48, 0.2, 161, 3, 1, 0, 0, 652, 10, 1], "semantic": {"name": "unserialized", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " unserialized = self.robot.blind_wavelet(serialized)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L150_C4", "label": "assertEquals()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.5747, 0.0038, 2, 0.48, 0.3, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.creator, unserialized.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L151_C4", "label": "assertEquals()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.5785, 0.0038, 2, 0.48, 0.4, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.creation_time, unserialized.creation_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L152_C4", "label": "assertEquals()", "type": "expression", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.5843, 0.0077, 2, 0.48, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.last_modified_time,\n unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L154_C4", "label": "assertEquals()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.59, 0.0038, 2, 0.48, 0.6, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.root_blip.blip_id, unserialized.root_blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L155_C4", "label": "assertEquals()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.5939, 0.0038, 2, 0.48, 0.7, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.title, unserialized.title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L156_C4", "label": "assertEquals()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.5977, 0.0038, 2, 0.48, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.wave_id, unserialized.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L157_C4", "label": "assertEquals()", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.6015, 0.0038, 2, 0.48, 0.9, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.wavelet_id, unserialized.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L158_C4", "label": "assertEquals()", "type": "expression", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "vector": [8, 2, 0.6054, 0.0038, 2, 0.48, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.domain, unserialized.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "label": "testProxiedBlindWavelet", "type": "function", "loc": [160, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.6398, 0.0575, 1, 0.9, 0.875, 540, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "testProxiedBlindWavelet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testProxiedBlindWavelet(self):\n def handler(event, wavelet):\n blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')\n blind_wavelet.reply()\n blind_wavelet.submit_with(wavelet)\n\n self.robot.register_handler(events.WaveletParticipantsChanged, handler)\n json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "label": "handler", "type": "function", "loc": [161, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [2, 2, 0.6226, 0.0153, 2, 0.56, 0.0, 388, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "handler", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handler(event, wavelet):\n blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')\n blind_wavelet.reply()\n blind_wavelet.submit_with(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L162_C6", "label": "blind_wavelet = blind_wavelet()", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "vector": [14, 3, 0.6207, 0.0038, 3, 0.86, 0.0, 652, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "blind_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L163_C6", "label": "reply()", "type": "expression", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "vector": [8, 3, 0.6245, 0.0038, 3, 0.86, 0.5, 714, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " blind_wavelet.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L164_C6", "label": "submit_with()", "type": "expression", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "vector": [8, 3, 0.6284, 0.0038, 3, 0.86, 1.0, 936, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "submit_with", "arg_names": [], "import_names": [], "rhs_call_name": "submit_with", "annotation": ""}, "snippet": " blind_wavelet.submit_with(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L166_C4", "label": "register_handler()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [8, 2, 0.636, 0.0038, 2, 0.56, 0.1429, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged, handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L167_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [14, 2, 0.6398, 0.0038, 2, 0.56, 0.2857, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L168_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [14, 2, 0.6437, 0.0038, 2, 0.56, 0.4286, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L170_C4", "label": "assertEqual()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [8, 2, 0.6513, 0.0038, 2, 0.56, 0.5714, 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(operations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L171_C4", "label": "assertEquals()", "type": "expression", "loc": [171, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [8, 2, 0.6571, 0.0077, 2, 0.56, 0.7143, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ops.ROBOT_NOTIFY_CAPABILITIES_HASH,\n operations[0]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L173_C4", "label": "assertEquals()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [8, 2, 0.6628, 0.0038, 2, 0.56, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ops.WAVELET_APPEND_BLIP, operations[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L174_C4", "label": "assertEquals()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "vector": [8, 2, 0.6667, 0.0038, 2, 0.56, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('proxyid', operations[1]['params']['proxyingFor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "label": "testCapabilitiesHashIncludesContextAndFilter", "type": "function", "loc": [176, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "vector": [2, 1, 0.7011, 0.0575, 1, 0.9, 1.0, 102, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "testCapabilitiesHashIncludesContextAndFilter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCapabilitiesHashIncludesContextAndFilter(self):\n robot1 = robot.Robot('Robot1')\n robot1.register_handler(events.WaveletSelfAdded, lambda: '')\n\n robot2 = robot.Robot('Robot2')\n robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL)\n self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L177_C4", "label": "robot1 = Robot()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [14, 2, 0.6782, 0.0038, 2, 0.64, 0.0, 345, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot1", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot1 = robot.Robot('Robot1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L178_C4", "label": "register_handler()", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.682, 0.0038, 2, 0.64, 0.1111, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot1.register_handler(events.WaveletSelfAdded, lambda: '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L180_C4", "label": "robot2 = Robot()", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [14, 2, 0.6897, 0.0038, 2, 0.64, 0.2222, 919, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot2", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot2 = robot.Robot('Robot2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L181_C4", "label": "register_handler()", "type": "expression", "loc": [181, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.6954, 0.0077, 2, 0.64, 0.3333, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L183_C4", "label": "assertNotEqual()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.7011, 0.0038, 2, 0.64, 0.4444, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L185_C4", "label": "robot3 = Robot()", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [14, 2, 0.7088, 0.0038, 2, 0.64, 0.5556, 271, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot3", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot3 = robot.Robot('Robot3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L186_C4", "label": "register_handler()", "type": "expression", "loc": [186, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.7146, 0.0077, 2, 0.64, 0.6667, 116, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL, filter=\"foo\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L188_C4", "label": "assertNotEqual()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.7203, 0.0038, 2, 0.64, 0.7778, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L189_C4", "label": "assertNotEqual()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.7241, 0.0038, 2, 0.64, 0.8889, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot3.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L190_C4", "label": "assertNotEqual()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "vector": [8, 2, 0.728, 0.0038, 2, 0.64, 1.0, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot2.capabilities_hash(), robot3.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "label": "TestGetCapabilitiesXml", "type": "class", "loc": [192, 257], "level": 0, "parent": null, "vector": [3, 0, 0.8602, 0.2529, 0, 0.66, 0.9286, 232, 0, 6, 0, 0, 878, 0, 12], "semantic": {"name": "TestGetCapabilitiesXml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestGetCapabilitiesXml(unittest.TestCase):\n\n def setUp(self):\n self.robot = robot.Robot('Testy')\n self.robot.capabilities_hash = lambda: '1'\n\n def assertStringsEqual(self, s1, s2):\n self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2", "label": "setUp", "type": "function", "loc": [194, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.7471, 0.0115, 1, 0.7, 0.0, 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.robot = robot.Robot('Testy')\n self.robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L195_C4", "label": "self.robot = Robot()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2", "vector": [14, 2, 0.7471, 0.0038, 2, 0.3, 0.0, 879, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "self.robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " self.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L196_C4", "label": "self.robot.capabilities_hash =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2", "vector": [14, 2, 0.751, 0.0038, 2, 0.3, 1.0, 633, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.capabilities_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L198_C2", "label": "assertStringsEqual", "type": "function", "loc": [198, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.7605, 0.0077, 1, 0.7, 0.2, 567, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": ["self", "s1", "s2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertStringsEqual(self, s1, s2):\n self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L199_C4", "label": "assertEqual()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L198_C2", "vector": [8, 2, 0.7625, 0.0038, 2, 0.13, 0.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "label": "testDefault", "type": "function", "loc": [201, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.7874, 0.0383, 1, 0.7, 0.4, 138, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testDefault", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDefault(self):\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L202_C4", "label": "expected =", "type": "assigned_variable", "loc": [202, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "vector": [14, 2, 0.7854, 0.0268, 2, 0.36, 0.0, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L209_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "vector": [14, 2, 0.8008, 0.0038, 2, 0.36, 0.5, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L210_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "vector": [8, 2, 0.8046, 0.0038, 2, 0.36, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "label": "testUrls", "type": "function", "loc": [212, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.8391, 0.0575, 1, 0.7, 0.6, 223, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testUrls", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testUrls(self):\n profile_robot = robot.Robot(\n 'Testy',\n image_url='http://example.com/image.png',\n profile_url='http://example.com/profile.xml')\n profile_robot.capabilities_hash = lambda: '1'\n expected = (\n '<?xml version=\"1.0\"?>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L213_C4", "label": "profile_robot = Robot()", "type": "assigned_variable", "loc": [213, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "vector": [14, 2, 0.8218, 0.0153, 2, 0.82, 0.0, 545, 3, 3, 0, 0, 440, 10, 1], "semantic": {"name": "profile_robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " profile_robot = robot.Robot(\n 'Testy',\n image_url='http://example.com/image.png',\n profile_url='http://example.com/profile.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L217_C4", "label": "profile_robot.capabilities_hash =", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "vector": [14, 2, 0.8314, 0.0038, 2, 0.82, 0.25, 126, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "profile_robot.capabilities_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " profile_robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L218_C4", "label": "expected =", "type": "assigned_variable", "loc": [218, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "vector": [14, 2, 0.8467, 0.0268, 2, 0.82, 0.5, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L225_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "vector": [14, 2, 0.8621, 0.0038, 2, 0.82, 0.75, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = profile_robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L226_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "vector": [8, 2, 0.8659, 0.0038, 2, 0.82, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "label": "testConsumerKey", "type": "function", "loc": [228, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.8985, 0.0536, 1, 0.7, 0.8, 85, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testConsumerKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConsumerKey(self):\n # setup_oauth doesn't work during testing, so heavy handed setting of\n # properties it is:\n self.robot._consumer_key = 'consumer'\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L231_C4", "label": "self.robot._consumer_key =", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "vector": [14, 2, 0.8851, 0.0038, 2, 0.03, 0.0, 170, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.robot._consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot._consumer_key = 'consumer'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L232_C4", "label": "expected =", "type": "assigned_variable", "loc": [232, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "vector": [14, 2, 0.9023, 0.0307, 2, 0.03, 0.3333, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:consumer_key>consumer</w:consumer_key>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L240_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "vector": [14, 2, 0.9195, 0.0038, 2, 0.03, 0.6667, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L241_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "vector": [8, 2, 0.9234, 0.0038, 2, 0.03, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "label": "testCapsAndEvents", "type": "function", "loc": [243, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "vector": [2, 1, 0.9579, 0.0575, 1, 0.7, 1.0, 559, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testCapsAndEvents", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCapsAndEvents(self):\n self.robot.register_handler(events.BlipSubmitted, None,\n context=[events.Context.SELF,\n events.Context.ROOT])\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L244_C4", "label": "register_handler()", "type": "expression", "loc": [244, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "vector": [8, 2, 0.9387, 0.0115, 2, 0.16, 0.0, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.BlipSubmitted, None,\n context=[events.Context.SELF,\n events.Context.ROOT])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L247_C4", "label": "expected =", "type": "assigned_variable", "loc": [247, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "vector": [14, 2, 0.9617, 0.0345, 2, 0.16, 0.3333, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n'\n ' <w:capability name=\"%s\" context=\"SELF,ROOT\"/>\\n'\n '</w:capabilities>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L256_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "vector": [14, 2, 0.9808, 0.0038, 2, 0.16, 0.6667, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L257_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "vector": [8, 2, 0.9847, 0.0038, 2, 0.16, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:If_L260_C0", "label": "if", "type": "if", "loc": [260, 261], "level": 0, "parent": null, "vector": [4, 0, 0.9981, 0.0077, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L261_C2", "label": "main()", "type": "expression", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1113:If_L260_C0", "vector": [8, 1, 1.0, 0.0038, 1, 0.6, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L94_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L95_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L96_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L97_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L98_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L99_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L118_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L128_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L129_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L130_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L142_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:For_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L143_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L163_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L164_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Assign_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1113:If_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1113:Expr_L261_C2"}] |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Run robot from the commandline for testing.
This robot_runner let's you define event handlers using flags and takes the
json input from the std in and writes out the json output to stdout.
for example
cat events | commandline_robot_runner.py \
--eventdef-blip_submitted="wavelet.title='title'"
"""
__author__ = 'douwe@google.com (Douwe Osinga)'
import sys
import urllib
from google3.pyglib import app
from google3.pyglib import flags
from google3.walkabout.externalagents import api
from google3.walkabout.externalagents.api import blip
from google3.walkabout.externalagents.api import element
from google3.walkabout.externalagents.api import errors
from google3.walkabout.externalagents.api import events
from google3.walkabout.externalagents.api import ops
from google3.walkabout.externalagents.api import robot
from google3.walkabout.externalagents.api import util
FLAGS = flags.FLAGS
for event in events.ALL:
flags.DEFINE_string('eventdef_' + event.type.lower(),
'',
'Event definition for the %s event' % event.type)
def handle_event(src, bot, e, w):
"""Handle an event by executing the source code src."""
globs = {'e': e, 'w': w, 'api': api, 'bot': bot,
'blip': blip, 'element': element, 'errors': errors,
'events': events, 'ops': ops, 'robot': robot,
'util': util}
exec src in globs
def run_bot(input_file, output_file):
"""Run a robot defined on the command line."""
cmdbot = robot.Robot('Commandline bot')
for event in events.ALL:
src = getattr(FLAGS, 'eventdef_' + event.type.lower())
src = urllib.unquote_plus(src)
if src:
cmdbot.register_handler(event,
lambda event, wavelet, src=src, bot=cmdbot:
handle_event(src, bot, event, wavelet))
json_body = unicode(input_file.read(), 'utf8')
json_response = cmdbot.process_events(json_body)
output_file.write(json_response)
def main(argv):
run_bot(sys.stdin, sys.stdout)
if __name__ == '__main__':
app.run()
| ajibawa-2023/Python-Code-Large/train/row_1114 | 36 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1304, 0.1304, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Run robot from the commandline for testing.\n\nThis robot_runner let's you define event handlers using flags and takes the\njson input from the std in and writes out the json output to stdout.\n\nfor example\n cat events | commandline_robot_runner.py \\\n --eventdef-blip_submitted=\"wavelet.title='title'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L15_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.2174, 0.0145, 0, 0.66, 0.0526, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'douwe@google.com (Douwe Osinga)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2464, 0.0145, 0, 0.66, 0.1053, 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_1114:Import_L18_C0", "label": "urllib import urllib", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2609, 0.0145, 0, 0.66, 0.1579, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L20_C0", "label": "from google3.pyglib import app", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2899, 0.0145, 0, 0.66, 0.2105, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L21_C0", "label": "from google3.pyglib import flags", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.3043, 0.0145, 0, 0.66, 0.2632, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["flags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L23_C0", "label": "from google3.walkabout.externalagents import api", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0145, 0, 0.66, 0.3158, 770, 0, 1, 0, 0, 770, 0, 0], "semantic": {"name": "google3.walkabout.externalagents", "arg_names": [], "import_names": ["api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents import api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L25_C0", "label": "from google3.walkabout.externalagents.api import blip", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3623, 0.0145, 0, 0.66, 0.3684, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L26_C0", "label": "from google3.walkabout.externalagents.api import element", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3768, 0.0145, 0, 0.66, 0.4211, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L27_C0", "label": "from google3.walkabout.externalagents.api import errors", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3913, 0.0145, 0, 0.66, 0.4737, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L28_C0", "label": "from google3.walkabout.externalagents.api import events", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.4058, 0.0145, 0, 0.66, 0.5263, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L29_C0", "label": "from google3.walkabout.externalagents.api import ops", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.4203, 0.0145, 0, 0.66, 0.5789, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L30_C0", "label": "from google3.walkabout.externalagents.api import robot", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.4348, 0.0145, 0, 0.66, 0.6316, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:ImportFrom_L31_C0", "label": "from google3.walkabout.externalagents.api import util", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.4493, 0.0145, 0, 0.66, 0.6842, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L33_C0", "label": "FLAGS =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4783, 0.0145, 0, 0.66, 0.7368, 578, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLAGS = flags.FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L35_C0", "label": "for event", "type": "for", "loc": [35, 38], "level": 0, "parent": null, "vector": [6, 0, 0.529, 0.058, 0, 0.66, 0.7895, 371, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for event in events.ALL:\n flags.DEFINE_string('eventdef_' + event.type.lower(),\n '',\n 'Event definition for the %s event' % event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L36_C2", "label": "DEFINE_string()", "type": "expression", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L35_C0", "vector": [8, 1, 0.5362, 0.0435, 1, 0.63, 0.0, 430, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "DEFINE_string", "arg_names": [], "import_names": [], "rhs_call_name": "DEFINE_string", "annotation": ""}, "snippet": " flags.DEFINE_string('eventdef_' + event.type.lower(),\n '',\n 'Event definition for the %s event' % event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "label": "handle_event", "type": "function", "loc": [41, 47], "level": 0, "parent": null, "vector": [2, 0, 0.6377, 0.1014, 0, 0.66, 0.8421, 48, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "handle_event", "arg_names": ["src", "bot", "e", "w"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def handle_event(src, bot, e, w):\n \"\"\"Handle an event by executing the source code src.\"\"\"\n globs = {'e': e, 'w': w, 'api': api, 'bot': bot,\n 'blip': blip, 'element': element, 'errors': errors,\n 'events': events, 'ops': ops, 'robot': robot,\n 'util': util}\n exec(src in globs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L42_C2", "label": "expression", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "vector": [8, 1, 0.6087, 0.0145, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handle an event by executing the source code src.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L43_C2", "label": "globs =", "type": "assigned_variable", "loc": [43, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "vector": [14, 1, 0.6449, 0.058, 1, 0.54, 0.5, 74, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "globs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " globs = {'e': e, 'w': w, 'api': api, 'bot': bot,\n 'blip': blip, 'element': element, 'errors': errors,\n 'events': events, 'ops': ops, 'robot': robot,\n 'util': util}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L47_C2", "label": "exec()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "vector": [8, 1, 0.6812, 0.0145, 1, 0.54, 1.0, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec(src in globs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "label": "run_bot", "type": "function", "loc": [50, 62], "level": 0, "parent": null, "vector": [2, 0, 0.8116, 0.1884, 0, 0.66, 0.8947, 707, 0, 2, 0, 0, 0, 0, 10], "semantic": {"name": "run_bot", "arg_names": ["input_file", "output_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run_bot(input_file, output_file):\n \"\"\"Run a robot defined on the command line.\"\"\"\n cmdbot = robot.Robot('Commandline bot')\n for event in events.ALL:\n src = getattr(FLAGS, 'eventdef_' + event.type.lower())\n src = urllib.unquote_plus(src)\n if src:\n cmdbot.register_handler(event,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [8, 1, 0.7391, 0.0145, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Run a robot defined on the command line.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L52_C2", "label": "cmdbot = Robot()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [14, 1, 0.7536, 0.0145, 1, 0.26, 0.2, 293, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "cmdbot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " cmdbot = robot.Robot('Commandline bot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "label": "for event", "type": "for", "loc": [53, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [6, 1, 0.8116, 0.1014, 1, 0.26, 0.4, 371, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for event in events.ALL:\n src = getattr(FLAGS, 'eventdef_' + event.type.lower())\n src = urllib.unquote_plus(src)\n if src:\n cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L54_C4", "label": "src = getattr()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "vector": [14, 2, 0.7826, 0.0145, 2, 0.93, 0.0, 345, 3, 2, 0, 0, 121, 10, 2], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " src = getattr(FLAGS, 'eventdef_' + event.type.lower())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L55_C4", "label": "src = unquote_plus()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "vector": [14, 2, 0.7971, 0.0145, 2, 0.93, 0.5, 345, 3, 1, 0, 0, 449, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "unquote_plus", "annotation": ""}, "snippet": " src = urllib.unquote_plus(src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "vector": [4, 2, 0.8333, 0.058, 2, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if src:\n cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L57_C6", "label": "register_handler()", "type": "expression", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L56_C4", "vector": [8, 3, 0.8406, 0.0435, 3, 0.39, 0.0, 116, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L60_C2", "label": "json_body = unicode()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [14, 1, 0.8696, 0.0145, 1, 0.26, 0.6, 958, 3, 2, 0, 0, 733, 10, 2], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " json_body = unicode(input_file.read(), 'utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L61_C2", "label": "json_response = process_events()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [14, 1, 0.8841, 0.0145, 1, 0.26, 0.8, 870, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json_response", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json_response = cmdbot.process_events(json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L62_C2", "label": "write()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "vector": [8, 1, 0.8986, 0.0145, 1, 0.26, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " output_file.write(json_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 66], "level": 0, "parent": null, "vector": [2, 0, 0.9493, 0.029, 0, 0.66, 0.9474, 624, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": ["argv"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main(argv):\n run_bot(sys.stdin, sys.stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L66_C2", "label": "run_bot()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L65_C0", "vector": [8, 1, 0.9565, 0.0145, 1, 0.0, 0.0, 707, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run_bot", "arg_names": [], "import_names": [], "rhs_call_name": "run_bot", "annotation": ""}, "snippet": " run_bot(sys.stdin, sys.stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L68_C0", "label": "if", "type": "if", "loc": [68, 69], "level": 0, "parent": null, "vector": [4, 0, 0.9928, 0.029, 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 app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L69_C2", "label": "run()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L68_C0", "vector": [8, 1, 1.0, 0.0145, 1, 0.11, 0.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " app.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1114:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1114:Expr_L69_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the robot module."""
import unittest
import events
import ops
import robot
import simplejson
BLIP_JSON = ('{"wdykLROk*13":'
'{"lastModifiedTime":1242079608457,'
'"contributors":["someguy@test.com"],'
'"waveletId":"test.com!conv+root",'
'"waveId":"test.com!wdykLROk*11",'
'"parentBlipId":null,'
'"version":3,'
'"creator":"someguy@test.com",'
'"content":"\\nContent!",'
'"blipId":"wdykLROk*13","'
'annotations":[{"range":{"start":0,"end":1},'
'"name":"user/e/davidbyttow@google.com","value":"David"}],'
'"elements":{},'
'"childBlipIds":[]}'
'}')
WAVELET_JSON = ('{"lastModifiedTime":1242079611003,'
'"title":"A title",'
'"waveletId":"test.com!conv+root",'
'"rootBlipId":"wdykLROk*13",'
'"dataDocuments":null,'
'"creationTime":1242079608457,'
'"waveId":"test.com!wdykLROk*11",'
'"participants":["someguy@test.com","monty@appspot.com"],'
'"creator":"someguy@test.com",'
'"version":5}')
EVENTS_JSON = ('[{"timestamp":1242079611003,'
'"modifiedBy":"someguy@test.com",'
'"properties":{"participantsRemoved":[],'
'"participantsAdded":["monty@appspot.com"]},'
'"type":"WAVELET_PARTICIPANTS_CHANGED"}]')
TEST_JSON = '{"blips":%s,"wavelet":%s,"events":%s}' % (
BLIP_JSON, WAVELET_JSON, EVENTS_JSON)
NEW_WAVE_JSON = [{"data":
{"waveletId": "wavesandbox.com!conv+root",
"blipId": "b+LrODcLZkDlu", "waveId":
"wavesandbox.com!w+LrODcLZkDlt"},
"id": "op2"}]
NEW_WAVE_JSON_OLD = [{'data':
[{'data':
{'waveletId': 'googlewave.com!conv+root',
'blipId': 'b+VqQXQbZkCP1',
'waveId': 'googlewave.com!w+VqQXQbZkCP0'},
'id': 'wavelet.create1265055048410'}],
'id': 'op10'}];
class TestRobot(unittest.TestCase):
"""Tests for testing the basic parsing of json in robots."""
def setUp(self):
self.robot = robot.Robot('Testy')
def testCreateWave(self):
self.robot.submit = lambda x: NEW_WAVE_JSON
new_wave = self.robot.new_wave('wavesandbox.com', submit=True)
self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)
self.robot.submit = lambda x: NEW_WAVE_JSON_OLD
new_wave = self.robot.new_wave('googlewave.com', submit=True)
self.assertEqual('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)
def testEventParsing(self):
def check(event, wavelet):
# Test some basic properties; the rest should be covered by
# ops.CreateContext.
root = wavelet.root_blip
self.assertEqual(1, len(wavelet.blips))
self.assertEqual('wdykLROk*13', root.blip_id)
self.assertEqual('test.com!wdykLROk*11', root.wave_id)
self.assertEqual('test.com!conv+root', root.wavelet_id)
self.assertEqual('WAVELET_PARTICIPANTS_CHANGED', event.type)
self.assertEqual({'participantsRemoved': [],
'participantsAdded': ['monty@appspot.com']},
event.properties)
self.robot.test_called = True
self.robot.test_called = False
self.robot.register_handler(events.WaveletParticipantsChanged,
check)
json = self.robot.process_events(TEST_JSON)
self.assertTrue(self.robot.test_called)
operations = simplejson.loads(json)
# there should be one operation indicating the current version:
self.assertEqual(1, len(operations))
def testWrongEventsIgnored(self):
self.robot.test_called = True
def check(event, wavelet):
called = True
self.robot.test_called = False
self.robot.register_handler(events.BlipSubmitted,
check)
self.robot.process_events(TEST_JSON)
self.assertFalse(self.robot.test_called)
def testOperationParsing(self):
def check(event, wavelet):
wavelet.reply()
wavelet.title = 'new title'
wavelet.root_blip.append_markup('<b>Hello</b>')
self.robot.register_handler(events.WaveletParticipantsChanged,
check)
json = self.robot.process_events(TEST_JSON)
operations = simplejson.loads(json)
expected = set([ops.ROBOT_NOTIFY_CAPABILITIES_HASH,
ops.WAVELET_APPEND_BLIP,
ops.WAVELET_SET_TITLE,
ops.DOCUMENT_APPEND_MARKUP])
methods = [operation['method'] for operation in operations]
for method in methods:
self.assertTrue(method in expected)
expected.remove(method)
self.assertEquals(0, len(expected))
def testSerializeWavelets(self):
wavelet = self.robot.blind_wavelet(TEST_JSON)
serialized = wavelet.serialize()
unserialized = self.robot.blind_wavelet(serialized)
self.assertEquals(wavelet.creator, unserialized.creator)
self.assertEquals(wavelet.creation_time, unserialized.creation_time)
self.assertEquals(wavelet.last_modified_time,
unserialized.last_modified_time)
self.assertEquals(wavelet.root_blip.blip_id, unserialized.root_blip.blip_id)
self.assertEquals(wavelet.title, unserialized.title)
self.assertEquals(wavelet.wave_id, unserialized.wave_id)
self.assertEquals(wavelet.wavelet_id, unserialized.wavelet_id)
self.assertEquals(wavelet.domain, unserialized.domain)
def testProxiedBlindWavelet(self):
def handler(event, wavelet):
blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')
blind_wavelet.reply()
blind_wavelet.submit_with(wavelet)
self.robot.register_handler(events.WaveletParticipantsChanged, handler)
json = self.robot.process_events(TEST_JSON)
operations = simplejson.loads(json)
self.assertEqual(2, len(operations))
self.assertEquals(ops.ROBOT_NOTIFY_CAPABILITIES_HASH,
operations[0]['method'])
self.assertEquals(ops.WAVELET_APPEND_BLIP, operations[1]['method'])
self.assertEquals('proxyid', operations[1]['params']['proxyingFor'])
def testCapabilitiesHashIncludesContextAndFilter(self):
robot1 = robot.Robot('Robot1')
robot1.register_handler(events.WaveletSelfAdded, lambda: '')
robot2 = robot.Robot('Robot2')
robot2.register_handler(events.WaveletSelfAdded, lambda: '',
context=events.Context.ALL)
self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())
robot3 = robot.Robot('Robot3')
robot2.register_handler(events.WaveletSelfAdded, lambda: '',
context=events.Context.ALL, filter="foo")
self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())
self.assertNotEqual(robot1.capabilities_hash(), robot3.capabilities_hash())
self.assertNotEqual(robot2.capabilities_hash(), robot3.capabilities_hash())
class TestGetCapabilitiesXml(unittest.TestCase):
def setUp(self):
self.robot = robot.Robot('Testy')
self.robot.capabilities_hash = lambda: '1'
def assertStringsEqual(self, s1, s2):
self.assertEqual(s1, s2, 'Strings differ:\n%s--\n%s' % (s1, s2))
def testDefault(self):
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testUrls(self):
profile_robot = robot.Robot(
'Testy',
image_url='http://example.com/image.png',
profile_url='http://example.com/profile.xml')
profile_robot.capabilities_hash = lambda: '1'
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = profile_robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testConsumerKey(self):
# setup_oauth doesn't work during testing, so heavy handed setting of
# properties it is:
self.robot._consumer_key = 'consumer'
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:consumer_key>consumer</w:consumer_key>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n</w:capabilities>\n'
'</w:robot>\n') % ops.PROTOCOL_VERSION
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
def testCapsAndEvents(self):
self.robot.register_handler(events.BlipSubmitted, None,
context=[events.Context.SELF,
events.Context.ROOT])
expected = (
'<?xml version="1.0"?>\n'
'<w:robot xmlns:w="http://wave.google.com/extensions/robots/1.0">\n'
'<w:version>1</w:version>\n'
'<w:protocolversion>%s</w:protocolversion>\n'
'<w:capabilities>\n'
' <w:capability name="%s" context="SELF,ROOT"/>\n'
'</w:capabilities>\n'
'</w:robot>\n') % (ops.PROTOCOL_VERSION, events.BlipSubmitted.type)
xml = self.robot.capabilities_xml()
self.assertStringsEqual(expected, xml)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1115 | 124 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0651, 0.0038, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the robot module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Import_L19_C0", "label": "unittest import unittest", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0728, 0.0038, 0, 0.66, 0.0714, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Import_L21_C0", "label": "events import events", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0805, 0.0038, 0, 0.66, 0.1429, 830, 0, 1, 0, 0, 830, 0, 0], "semantic": {"name": "events", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Import_L22_C0", "label": "ops import ops", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0843, 0.0038, 0, 0.66, 0.2143, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Import_L23_C0", "label": "robot import robot", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0881, 0.0038, 0, 0.66, 0.2857, 735, 0, 1, 0, 0, 735, 0, 0], "semantic": {"name": "robot", "arg_names": [], "import_names": ["robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Import_L24_C0", "label": "simplejson import simplejson", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.092, 0.0038, 0, 0.66, 0.3571, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L26_C0", "label": "BLIP_JSON =", "type": "assigned_variable", "loc": [26, 40], "level": 0, "parent": null, "vector": [14, 0, 0.1264, 0.0575, 0, 0.66, 0.4286, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_JSON = ('{\"wdykLROk*13\":'\n '{\"lastModifiedTime\":1242079608457,'\n '\"contributors\":[\"someguy@test.com\"],'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"parentBlipId\":null,'\n '\"version\":3,'\n '\"creator\":\"someguy@test.com\",'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L42_C0", "label": "WAVELET_JSON =", "type": "assigned_variable", "loc": [42, 51], "level": 0, "parent": null, "vector": [14, 0, 0.1782, 0.0383, 0, 0.66, 0.5, 26, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_JSON = ('{\"lastModifiedTime\":1242079611003,'\n '\"title\":\"A title\",'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"rootBlipId\":\"wdykLROk*13\",'\n '\"dataDocuments\":null,'\n '\"creationTime\":1242079608457,'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"participants\":[\"someguy@test.com\",\"monty@appspot.com\"],'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L53_C0", "label": "EVENTS_JSON =", "type": "assigned_variable", "loc": [53, 57], "level": 0, "parent": null, "vector": [14, 0, 0.2107, 0.0192, 0, 0.66, 0.5714, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "EVENTS_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EVENTS_JSON = ('[{\"timestamp\":1242079611003,'\n '\"modifiedBy\":\"someguy@test.com\",'\n '\"properties\":{\"participantsRemoved\":[],'\n '\"participantsAdded\":[\"monty@appspot.com\"]},'\n '\"type\":\"WAVELET_PARTICIPANTS_CHANGED\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L59_C0", "label": "TEST_JSON =", "type": "assigned_variable", "loc": [59, 60], "level": 0, "parent": null, "vector": [14, 0, 0.228, 0.0077, 0, 0.66, 0.6429, 23, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEST_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_JSON = '{\"blips\":%s,\"wavelet\":%s,\"events\":%s}' % (\n BLIP_JSON, WAVELET_JSON, EVENTS_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L62_C0", "label": "NEW_WAVE_JSON =", "type": "assigned_variable", "loc": [62, 66], "level": 0, "parent": null, "vector": [14, 0, 0.2452, 0.0192, 0, 0.66, 0.7143, 945, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "NEW_WAVE_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NEW_WAVE_JSON = [{\"data\":\n {\"waveletId\": \"wavesandbox.com!conv+root\",\n \"blipId\": \"b+LrODcLZkDlu\", \"waveId\":\n \"wavesandbox.com!w+LrODcLZkDlt\"},\n \"id\": \"op2\"}]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L68_C0", "label": "NEW_WAVE_JSON_OLD =", "type": "assigned_variable", "loc": [68, 74], "level": 0, "parent": null, "vector": [14, 0, 0.272, 0.0268, 0, 0.66, 0.7857, 630, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "NEW_WAVE_JSON_OLD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "NEW_WAVE_JSON_OLD = [{'data':\n [{'data':\n {'waveletId': 'googlewave.com!conv+root',\n 'blipId': 'b+VqQXQbZkCP1',\n 'waveId': 'googlewave.com!w+VqQXQbZkCP0'},\n 'id': 'wavelet.create1265055048410'}],\n 'id': 'op10'}];"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "label": "TestRobot", "type": "class", "loc": [76, 190], "level": 0, "parent": null, "vector": [3, 0, 0.5096, 0.4406, 0, 0.66, 0.8571, 196, 0, 12, 0, 0, 878, 0, 71], "semantic": {"name": "TestRobot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestRobot(unittest.TestCase):\n \"\"\"Tests for testing the basic parsing of json in robots.\"\"\"\n\n def setUp(self):\n self.robot = robot.Robot('Testy')\n\n def testCreateWave(self):\n self.robot.submit = lambda x: NEW_WAVE_JSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L77_C2", "label": "expression", "type": "expression", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [8, 1, 0.295, 0.0038, 1, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests for testing the basic parsing of json in robots.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L79_C2", "label": "setUp", "type": "function", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.3046, 0.0077, 1, 0.32, 0.125, 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.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L80_C4", "label": "self.robot = Robot()", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L79_C2", "vector": [14, 2, 0.3065, 0.0038, 2, 0.75, 0.0, 879, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "self.robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " self.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "label": "testCreateWave", "type": "function", "loc": [82, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.3257, 0.0268, 1, 0.32, 0.25, 958, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testCreateWave", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCreateWave(self):\n self.robot.submit = lambda x: NEW_WAVE_JSON\n new_wave = self.robot.new_wave('wavesandbox.com', submit=True)\n self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)\n self.robot.submit = lambda x: NEW_WAVE_JSON_OLD\n new_wave = self.robot.new_wave('googlewave.com', submit=True)\n self.assertEqual('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L83_C4", "label": "self.robot.submit =", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [14, 2, 0.318, 0.0038, 2, 0.63, 0.0, 292, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.submit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.submit = lambda x: NEW_WAVE_JSON"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L84_C4", "label": "new_wave = new_wave()", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [14, 2, 0.3218, 0.0038, 2, 0.63, 0.2, 669, 3, 2, 0, 0, 669, 10, 1], "semantic": {"name": "new_wave", "arg_names": [], "import_names": [], "rhs_call_name": "new_wave", "annotation": ""}, "snippet": " new_wave = self.robot.new_wave('wavesandbox.com', submit=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L85_C4", "label": "assertEqual()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [8, 2, 0.3257, 0.0038, 2, 0.63, 0.4, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wavesandbox.com!w+LrODcLZkDlt', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L86_C4", "label": "self.robot.submit =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [14, 2, 0.3295, 0.0038, 2, 0.63, 0.6, 292, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.submit", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.submit = lambda x: NEW_WAVE_JSON_OLD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L87_C4", "label": "new_wave = new_wave()", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [14, 2, 0.3333, 0.0038, 2, 0.63, 0.8, 669, 3, 2, 0, 0, 669, 10, 1], "semantic": {"name": "new_wave", "arg_names": [], "import_names": [], "rhs_call_name": "new_wave", "annotation": ""}, "snippet": " new_wave = self.robot.new_wave('googlewave.com', submit=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L88_C4", "label": "assertEqual()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "vector": [8, 2, 0.3372, 0.0038, 2, 0.63, 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('googlewave.com!w+VqQXQbZkCP0', new_wave.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "label": "testEventParsing", "type": "function", "loc": [90, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.387, 0.0881, 1, 0.32, 0.375, 777, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "testEventParsing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testEventParsing(self):\n def check(event, wavelet):\n # Test some basic properties; the rest should be covered by\n # ops.CreateContext.\n root = wavelet.root_blip\n self.assertEqual(1, len(wavelet.blips))\n self.assertEqual('wdykLROk*13', root.blip_id)\n self.assertEqual('test.com!wdykLROk*11', root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "label": "check", "type": "function", "loc": [91, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [2, 2, 0.3716, 0.0498, 2, 0.87, 0.0, 803, 0, 2, 0, 0, 0, 0, 7], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n # Test some basic properties; the rest should be covered by\n # ops.CreateContext.\n root = wavelet.root_blip\n self.assertEqual(1, len(wavelet.blips))\n self.assertEqual('wdykLROk*13', root.blip_id)\n self.assertEqual('test.com!wdykLROk*11', root.wave_id)\n self.assertEqual('test.com!conv+root', root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L94_C6", "label": "root =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [14, 3, 0.3602, 0.0038, 3, 0.83, 0.0, 696, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " root = wavelet.root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L95_C6", "label": "assertEqual()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.364, 0.0038, 3, 0.83, 0.1429, 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(wavelet.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L96_C6", "label": "assertEqual()", "type": "expression", "loc": [96, 96], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.3678, 0.0038, 3, 0.83, 0.2857, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wdykLROk*13', root.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L97_C6", "label": "assertEqual()", "type": "expression", "loc": [97, 97], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.3716, 0.0038, 3, 0.83, 0.4286, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('test.com!wdykLROk*11', root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L98_C6", "label": "assertEqual()", "type": "expression", "loc": [98, 98], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.3755, 0.0038, 3, 0.83, 0.5714, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('test.com!conv+root', root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L99_C6", "label": "assertEqual()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.3793, 0.0038, 3, 0.83, 0.7143, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('WAVELET_PARTICIPANTS_CHANGED', event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L100_C6", "label": "assertEqual()", "type": "expression", "loc": [100, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [8, 3, 0.387, 0.0115, 3, 0.83, 0.8571, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual({'participantsRemoved': [],\n 'participantsAdded': ['monty@appspot.com']},\n event.properties)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L103_C6", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "vector": [14, 3, 0.3946, 0.0038, 3, 0.83, 1.0, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L105_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [14, 2, 0.4023, 0.0038, 2, 0.87, 0.1667, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L106_C4", "label": "register_handler()", "type": "expression", "loc": [106, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [8, 2, 0.408, 0.0077, 2, 0.87, 0.3333, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L108_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [14, 2, 0.4138, 0.0038, 2, 0.87, 0.5, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L109_C4", "label": "assertTrue()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [8, 2, 0.4176, 0.0038, 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.robot.test_called)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L110_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [14, 2, 0.4215, 0.0038, 2, 0.87, 0.8333, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L112_C4", "label": "assertEqual()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "vector": [8, 2, 0.4291, 0.0038, 2, 0.87, 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(1, len(operations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "label": "testWrongEventsIgnored", "type": "function", "loc": [114, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.4559, 0.0421, 1, 0.32, 0.5, 805, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testWrongEventsIgnored", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWrongEventsIgnored(self):\n self.robot.test_called = True\n\n def check(event, wavelet):\n called = True\n\n self.robot.test_called = False\n self.robot.register_handler(events.BlipSubmitted,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L115_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [14, 2, 0.4406, 0.0038, 2, 0.48, 0.0, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L117_C4", "label": "check", "type": "function", "loc": [117, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [2, 2, 0.4502, 0.0077, 2, 0.48, 0.2, 803, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L118_C6", "label": "called =", "type": "assigned_variable", "loc": [118, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L117_C4", "vector": [14, 3, 0.4521, 0.0038, 3, 0.22, 0.0, 30, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " called = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L120_C4", "label": "self.robot.test_called =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [14, 2, 0.4598, 0.0038, 2, 0.48, 0.4, 51, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.robot.test_called", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.test_called = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L121_C4", "label": "register_handler()", "type": "expression", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [8, 2, 0.4655, 0.0077, 2, 0.48, 0.6, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.BlipSubmitted,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L123_C4", "label": "process_events()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [8, 2, 0.4713, 0.0038, 2, 0.48, 0.8, 196, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "process_events", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L124_C4", "label": "assertFalse()", "type": "expression", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "vector": [8, 2, 0.4751, 0.0038, 2, 0.48, 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.robot.test_called)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "label": "testOperationParsing", "type": "function", "loc": [126, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.5172, 0.0728, 1, 0.32, 0.625, 642, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testOperationParsing", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testOperationParsing(self):\n def check(event, wavelet):\n wavelet.reply()\n wavelet.title = 'new title'\n wavelet.root_blip.append_markup('<b>Hello</b>')\n\n self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "label": "check", "type": "function", "loc": [127, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [2, 2, 0.4923, 0.0153, 2, 0.24, 0.0, 803, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "check", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check(event, wavelet):\n wavelet.reply()\n wavelet.title = 'new title'\n wavelet.root_blip.append_markup('<b>Hello</b>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L128_C6", "label": "reply()", "type": "expression", "loc": [128, 128], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "vector": [8, 3, 0.4904, 0.0038, 3, 0.03, 0.0, 714, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " wavelet.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L129_C6", "label": "wavelet.title =", "type": "assigned_variable", "loc": [129, 129], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "vector": [14, 3, 0.4943, 0.0038, 3, 0.03, 0.5, 676, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet.title = 'new title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L130_C6", "label": "append_markup()", "type": "expression", "loc": [130, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "vector": [8, 3, 0.4981, 0.0038, 3, 0.03, 1.0, 513, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "append_markup", "annotation": ""}, "snippet": " wavelet.root_blip.append_markup('<b>Hello</b>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L132_C4", "label": "register_handler()", "type": "expression", "loc": [132, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [8, 2, 0.5077, 0.0077, 2, 0.24, 0.1429, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged,\n check)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L134_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [14, 2, 0.5134, 0.0038, 2, 0.24, 0.2857, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L135_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [14, 2, 0.5172, 0.0038, 2, 0.24, 0.4286, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L136_C4", "label": "expected = set()", "type": "assigned_variable", "loc": [136, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [14, 2, 0.5268, 0.0153, 2, 0.24, 0.5714, 361, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " expected = set([ops.ROBOT_NOTIFY_CAPABILITIES_HASH,\n ops.WAVELET_APPEND_BLIP,\n ops.WAVELET_SET_TITLE,\n ops.DOCUMENT_APPEND_MARKUP])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L140_C4", "label": "methods =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [14, 2, 0.5364, 0.0038, 2, 0.24, 0.7143, 110, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " methods = [operation['method'] for operation in operations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4", "label": "for method", "type": "for", "loc": [141, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [6, 2, 0.5441, 0.0115, 2, 0.24, 0.8571, 445, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for method in methods:\n self.assertTrue(method in expected)\n expected.remove(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L142_C6", "label": "assertTrue()", "type": "expression", "loc": [142, 142], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4", "vector": [8, 3, 0.5441, 0.0038, 3, 0.46, 0.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(method in expected)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L143_C6", "label": "remove()", "type": "expression", "loc": [143, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4", "vector": [8, 3, 0.5479, 0.0038, 3, 0.46, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " expected.remove(method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L144_C4", "label": "assertEquals()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "vector": [8, 2, 0.5517, 0.0038, 2, 0.24, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(expected))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "label": "testSerializeWavelets", "type": "function", "loc": [146, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.5824, 0.0498, 1, 0.32, 0.75, 970, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "testSerializeWavelets", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeWavelets(self):\n wavelet = self.robot.blind_wavelet(TEST_JSON)\n serialized = wavelet.serialize()\n unserialized = self.robot.blind_wavelet(serialized)\n self.assertEquals(wavelet.creator, unserialized.creator)\n self.assertEquals(wavelet.creation_time, unserialized.creation_time)\n self.assertEquals(wavelet.last_modified_time,\n unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L147_C4", "label": "wavelet = blind_wavelet()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [14, 2, 0.5632, 0.0038, 2, 0.02, 0.0, 147, 3, 1, 0, 0, 652, 10, 1], "semantic": {"name": "wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " wavelet = self.robot.blind_wavelet(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L148_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [14, 2, 0.567, 0.0038, 2, 0.02, 0.1, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = wavelet.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L149_C4", "label": "unserialized = blind_wavelet()", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [14, 2, 0.5709, 0.0038, 2, 0.02, 0.2, 161, 3, 1, 0, 0, 652, 10, 1], "semantic": {"name": "unserialized", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " unserialized = self.robot.blind_wavelet(serialized)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L150_C4", "label": "assertEquals()", "type": "expression", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.5747, 0.0038, 2, 0.02, 0.3, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.creator, unserialized.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L151_C4", "label": "assertEquals()", "type": "expression", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.5785, 0.0038, 2, 0.02, 0.4, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.creation_time, unserialized.creation_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L152_C4", "label": "assertEquals()", "type": "expression", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.5843, 0.0077, 2, 0.02, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.last_modified_time,\n unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L154_C4", "label": "assertEquals()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.59, 0.0038, 2, 0.02, 0.6, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.root_blip.blip_id, unserialized.root_blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L155_C4", "label": "assertEquals()", "type": "expression", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.5939, 0.0038, 2, 0.02, 0.7, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.title, unserialized.title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L156_C4", "label": "assertEquals()", "type": "expression", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.5977, 0.0038, 2, 0.02, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.wave_id, unserialized.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L157_C4", "label": "assertEquals()", "type": "expression", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.6015, 0.0038, 2, 0.02, 0.9, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.wavelet_id, unserialized.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L158_C4", "label": "assertEquals()", "type": "expression", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "vector": [8, 2, 0.6054, 0.0038, 2, 0.02, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.domain, unserialized.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "label": "testProxiedBlindWavelet", "type": "function", "loc": [160, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.6398, 0.0575, 1, 0.32, 0.875, 540, 0, 1, 0, 0, 0, 0, 11], "semantic": {"name": "testProxiedBlindWavelet", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testProxiedBlindWavelet(self):\n def handler(event, wavelet):\n blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')\n blind_wavelet.reply()\n blind_wavelet.submit_with(wavelet)\n\n self.robot.register_handler(events.WaveletParticipantsChanged, handler)\n json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "label": "handler", "type": "function", "loc": [161, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [2, 2, 0.6226, 0.0153, 2, 0.39, 0.0, 388, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "handler", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def handler(event, wavelet):\n blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')\n blind_wavelet.reply()\n blind_wavelet.submit_with(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L162_C6", "label": "blind_wavelet = blind_wavelet()", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "vector": [14, 3, 0.6207, 0.0038, 3, 0.2, 0.0, 652, 3, 2, 0, 0, 652, 10, 1], "semantic": {"name": "blind_wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "blind_wavelet", "annotation": ""}, "snippet": " blind_wavelet = self.robot.blind_wavelet(TEST_JSON, 'proxyid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L163_C6", "label": "reply()", "type": "expression", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "vector": [8, 3, 0.6245, 0.0038, 3, 0.2, 0.5, 714, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " blind_wavelet.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L164_C6", "label": "submit_with()", "type": "expression", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "vector": [8, 3, 0.6284, 0.0038, 3, 0.2, 1.0, 936, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "submit_with", "arg_names": [], "import_names": [], "rhs_call_name": "submit_with", "annotation": ""}, "snippet": " blind_wavelet.submit_with(wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L166_C4", "label": "register_handler()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [8, 2, 0.636, 0.0038, 2, 0.39, 0.1429, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.WaveletParticipantsChanged, handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L167_C4", "label": "json = process_events()", "type": "assigned_variable", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [14, 2, 0.6398, 0.0038, 2, 0.39, 0.2857, 463, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json = self.robot.process_events(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L168_C4", "label": "operations = loads()", "type": "assigned_variable", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [14, 2, 0.6437, 0.0038, 2, 0.39, 0.4286, 962, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " operations = simplejson.loads(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L170_C4", "label": "assertEqual()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [8, 2, 0.6513, 0.0038, 2, 0.39, 0.5714, 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(operations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L171_C4", "label": "assertEquals()", "type": "expression", "loc": [171, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [8, 2, 0.6571, 0.0077, 2, 0.39, 0.7143, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ops.ROBOT_NOTIFY_CAPABILITIES_HASH,\n operations[0]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L173_C4", "label": "assertEquals()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [8, 2, 0.6628, 0.0038, 2, 0.39, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ops.WAVELET_APPEND_BLIP, operations[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L174_C4", "label": "assertEquals()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "vector": [8, 2, 0.6667, 0.0038, 2, 0.39, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('proxyid', operations[1]['params']['proxyingFor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "label": "testCapabilitiesHashIncludesContextAndFilter", "type": "function", "loc": [176, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "vector": [2, 1, 0.7011, 0.0575, 1, 0.32, 1.0, 102, 0, 1, 0, 0, 0, 0, 18], "semantic": {"name": "testCapabilitiesHashIncludesContextAndFilter", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCapabilitiesHashIncludesContextAndFilter(self):\n robot1 = robot.Robot('Robot1')\n robot1.register_handler(events.WaveletSelfAdded, lambda: '')\n\n robot2 = robot.Robot('Robot2')\n robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL)\n self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L177_C4", "label": "robot1 = Robot()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [14, 2, 0.6782, 0.0038, 2, 0.91, 0.0, 345, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot1", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot1 = robot.Robot('Robot1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L178_C4", "label": "register_handler()", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.682, 0.0038, 2, 0.91, 0.1111, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot1.register_handler(events.WaveletSelfAdded, lambda: '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L180_C4", "label": "robot2 = Robot()", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [14, 2, 0.6897, 0.0038, 2, 0.91, 0.2222, 919, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot2", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot2 = robot.Robot('Robot2')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L181_C4", "label": "register_handler()", "type": "expression", "loc": [181, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.6954, 0.0077, 2, 0.91, 0.3333, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L183_C4", "label": "assertNotEqual()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.7011, 0.0038, 2, 0.91, 0.4444, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L185_C4", "label": "robot3 = Robot()", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [14, 2, 0.7088, 0.0038, 2, 0.91, 0.5556, 271, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "robot3", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " robot3 = robot.Robot('Robot3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L186_C4", "label": "register_handler()", "type": "expression", "loc": [186, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.7146, 0.0077, 2, 0.91, 0.6667, 116, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot2.register_handler(events.WaveletSelfAdded, lambda: '',\n context=events.Context.ALL, filter=\"foo\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L188_C4", "label": "assertNotEqual()", "type": "expression", "loc": [188, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.7203, 0.0038, 2, 0.91, 0.7778, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot2.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L189_C4", "label": "assertNotEqual()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.7241, 0.0038, 2, 0.91, 0.8889, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot1.capabilities_hash(), robot3.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L190_C4", "label": "assertNotEqual()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "vector": [8, 2, 0.728, 0.0038, 2, 0.91, 1.0, 120, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(robot2.capabilities_hash(), robot3.capabilities_hash())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "label": "TestGetCapabilitiesXml", "type": "class", "loc": [192, 257], "level": 0, "parent": null, "vector": [3, 0, 0.8602, 0.2529, 0, 0.66, 0.9286, 232, 0, 6, 0, 0, 878, 0, 12], "semantic": {"name": "TestGetCapabilitiesXml", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestGetCapabilitiesXml(unittest.TestCase):\n\n def setUp(self):\n self.robot = robot.Robot('Testy')\n self.robot.capabilities_hash = lambda: '1'\n\n def assertStringsEqual(self, s1, s2):\n self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2", "label": "setUp", "type": "function", "loc": [194, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.7471, 0.0115, 1, 0.48, 0.0, 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.robot = robot.Robot('Testy')\n self.robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L195_C4", "label": "self.robot = Robot()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2", "vector": [14, 2, 0.7471, 0.0038, 2, 0.82, 0.0, 879, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "self.robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " self.robot = robot.Robot('Testy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L196_C4", "label": "self.robot.capabilities_hash =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2", "vector": [14, 2, 0.751, 0.0038, 2, 0.82, 1.0, 633, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.robot.capabilities_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L198_C2", "label": "assertStringsEqual", "type": "function", "loc": [198, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.7605, 0.0077, 1, 0.48, 0.2, 567, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": ["self", "s1", "s2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertStringsEqual(self, s1, s2):\n self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L199_C4", "label": "assertEqual()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L198_C2", "vector": [8, 2, 0.7625, 0.0038, 2, 0.91, 0.0, 299, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(s1, s2, 'Strings differ:\\n%s--\\n%s' % (s1, s2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "label": "testDefault", "type": "function", "loc": [201, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.7874, 0.0383, 1, 0.48, 0.4, 138, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testDefault", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDefault(self):\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L202_C4", "label": "expected =", "type": "assigned_variable", "loc": [202, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "vector": [14, 2, 0.7854, 0.0268, 2, 0.61, 0.0, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L209_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "vector": [14, 2, 0.8008, 0.0038, 2, 0.61, 0.5, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L210_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "vector": [8, 2, 0.8046, 0.0038, 2, 0.61, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "label": "testUrls", "type": "function", "loc": [212, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.8391, 0.0575, 1, 0.48, 0.6, 223, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testUrls", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testUrls(self):\n profile_robot = robot.Robot(\n 'Testy',\n image_url='http://example.com/image.png',\n profile_url='http://example.com/profile.xml')\n profile_robot.capabilities_hash = lambda: '1'\n expected = (\n '<?xml version=\"1.0\"?>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L213_C4", "label": "profile_robot = Robot()", "type": "assigned_variable", "loc": [213, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "vector": [14, 2, 0.8218, 0.0153, 2, 0.97, 0.0, 545, 3, 3, 0, 0, 440, 10, 1], "semantic": {"name": "profile_robot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " profile_robot = robot.Robot(\n 'Testy',\n image_url='http://example.com/image.png',\n profile_url='http://example.com/profile.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L217_C4", "label": "profile_robot.capabilities_hash =", "type": "assigned_variable", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "vector": [14, 2, 0.8314, 0.0038, 2, 0.97, 0.25, 126, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "profile_robot.capabilities_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " profile_robot.capabilities_hash = lambda: '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L218_C4", "label": "expected =", "type": "assigned_variable", "loc": [218, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "vector": [14, 2, 0.8467, 0.0268, 2, 0.97, 0.5, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L225_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "vector": [14, 2, 0.8621, 0.0038, 2, 0.97, 0.75, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = profile_robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L226_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "vector": [8, 2, 0.8659, 0.0038, 2, 0.97, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "label": "testConsumerKey", "type": "function", "loc": [228, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.8985, 0.0536, 1, 0.48, 0.8, 85, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testConsumerKey", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConsumerKey(self):\n # setup_oauth doesn't work during testing, so heavy handed setting of\n # properties it is:\n self.robot._consumer_key = 'consumer'\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L231_C4", "label": "self.robot._consumer_key =", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "vector": [14, 2, 0.8851, 0.0038, 2, 0.73, 0.0, 170, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.robot._consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.robot._consumer_key = 'consumer'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L232_C4", "label": "expected =", "type": "assigned_variable", "loc": [232, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "vector": [14, 2, 0.9023, 0.0307, 2, 0.73, 0.3333, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:consumer_key>consumer</w:consumer_key>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n</w:capabilities>\\n'\n '</w:robot>\\n') % ops.PROTOCOL_VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L240_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "vector": [14, 2, 0.9195, 0.0038, 2, 0.73, 0.6667, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L241_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "vector": [8, 2, 0.9234, 0.0038, 2, 0.73, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "label": "testCapsAndEvents", "type": "function", "loc": [243, 257], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "vector": [2, 1, 0.9579, 0.0575, 1, 0.48, 1.0, 559, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testCapsAndEvents", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCapsAndEvents(self):\n self.robot.register_handler(events.BlipSubmitted, None,\n context=[events.Context.SELF,\n events.Context.ROOT])\n expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L244_C4", "label": "register_handler()", "type": "expression", "loc": [244, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "vector": [8, 2, 0.9387, 0.0115, 2, 0.98, 0.0, 116, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " self.robot.register_handler(events.BlipSubmitted, None,\n context=[events.Context.SELF,\n events.Context.ROOT])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L247_C4", "label": "expected =", "type": "assigned_variable", "loc": [247, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "vector": [14, 2, 0.9617, 0.0345, 2, 0.98, 0.3333, 361, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = (\n '<?xml version=\"1.0\"?>\\n'\n '<w:robot xmlns:w=\"http://wave.google.com/extensions/robots/1.0\">\\n'\n '<w:version>1</w:version>\\n'\n '<w:protocolversion>%s</w:protocolversion>\\n'\n '<w:capabilities>\\n'\n ' <w:capability name=\"%s\" context=\"SELF,ROOT\"/>\\n'\n '</w:capabilities>\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L256_C4", "label": "xml = capabilities_xml()", "type": "assigned_variable", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "vector": [14, 2, 0.9808, 0.0038, 2, 0.98, 0.6667, 324, 3, 0, 0, 0, 167, 10, 1], "semantic": {"name": "xml", "arg_names": [], "import_names": [], "rhs_call_name": "capabilities_xml", "annotation": ""}, "snippet": " xml = self.robot.capabilities_xml()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L257_C4", "label": "assertStringsEqual()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "vector": [8, 2, 0.9847, 0.0038, 2, 0.98, 1.0, 567, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertStringsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertStringsEqual", "annotation": ""}, "snippet": " self.assertStringsEqual(expected, xml)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:If_L260_C0", "label": "if", "type": "if", "loc": [260, 261], "level": 0, "parent": null, "vector": [4, 0, 0.9981, 0.0077, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L261_C2", "label": "main()", "type": "expression", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1115:If_L260_C0", "vector": [8, 1, 1.0, 0.0038, 1, 0.05, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L79_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L94_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L95_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L96_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L97_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L98_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L99_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L91_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L117_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L118_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L128_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L129_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L130_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L142_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:For_L141_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L143_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L126_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L163_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L164_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L171_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L160_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L76_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L212_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L228_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:ClassDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Assign_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:FunctionDef_L243_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1115:If_L260_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1115:Expr_L261_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the wavelet module."""
import unittest
import blip
import element
import ops
import wavelet
import simplejson
ROBOT_NAME = 'robot@appspot.com'
TEST_WAVELET_DATA = {
'creator': ROBOT_NAME,
'creationTime': 100,
'lastModifiedTime': 101,
'participants': [ROBOT_NAME],
'participantsRoles': {ROBOT_NAME: wavelet.Participants.ROLE_FULL},
'rootBlipId': 'blip-1',
'title': 'Title',
'waveId': 'test.com!w+g3h3im',
'waveletId': 'test.com!root+conv',
'tags': ['tag1', 'tag2'],
}
TEST_BLIP_DATA = {
'blipId': TEST_WAVELET_DATA['rootBlipId'],
'childBlipIds': [],
'content': '\ntesting',
'contributors': [TEST_WAVELET_DATA['creator'], 'robot@google.com'],
'creator': TEST_WAVELET_DATA['creator'],
'lastModifiedTime': TEST_WAVELET_DATA['lastModifiedTime'],
'parentBlipId': None,
'waveId': TEST_WAVELET_DATA['waveId'],
'elements': {},
'waveletId': TEST_WAVELET_DATA['waveletId'],
}
class TestWavelet(unittest.TestCase):
"""Tests the wavelet class."""
def setUp(self):
self.operation_queue = ops.OperationQueue()
self.all_blips = {}
self.blip = blip.Blip(TEST_BLIP_DATA,
self.all_blips,
self.operation_queue)
self.all_blips[self.blip.blip_id] = self.blip
self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,
self.all_blips,
None,
self.operation_queue)
self.wavelet.robot_address = ROBOT_NAME
def testWaveletProperties(self):
w = self.wavelet
self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)
self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)
self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],
w.last_modified_time)
self.assertEquals(len(TEST_WAVELET_DATA['participants']),
len(w.participants))
self.assertTrue(TEST_WAVELET_DATA['participants'][0] in w.participants)
self.assertEquals(TEST_WAVELET_DATA['rootBlipId'], w.root_blip.blip_id)
self.assertEquals(TEST_WAVELET_DATA['title'], w.title)
self.assertEquals(TEST_WAVELET_DATA['waveId'], w.wave_id)
self.assertEquals(TEST_WAVELET_DATA['waveletId'], w.wavelet_id)
self.assertEquals('test.com', w.domain)
def testWaveletMethods(self):
w = self.wavelet
reply = w.reply()
self.assertEquals(2, len(w.blips))
w.delete(reply)
self.assertEquals(1, len(w.blips))
self.assertEquals(0, len(w.data_documents))
self.wavelet.data_documents['key'] = 'value'
self.assert_('key' in w.data_documents)
self.assertEquals(1, len(w.data_documents))
for key in w.data_documents:
self.assertEquals(key, 'key')
self.assertEquals(1, len(w.data_documents.keys()))
self.wavelet.data_documents['key'] = None
self.assertEquals(0, len(w.data_documents))
num_participants = len(w.participants)
w.proxy_for('proxy').reply()
self.assertEquals(2, len(w.blips))
# check that the new proxy for participant was added
self.assertEquals(num_participants + 1, len(w.participants))
w._robot_address = ROBOT_NAME.replace('@', '+proxy@')
w.proxy_for('proxy').reply()
self.assertEquals(num_participants + 1, len(w.participants))
self.assertEquals(3, len(w.blips))
def testSetTitle(self):
self.blip._content = '\nOld title\n\nContent'
self.wavelet.title = 'New title \xd0\xb0\xd0\xb1\xd0\xb2'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals(u'\nNew title \u0430\u0431\u0432\n\nContent',
self.blip._content)
def testSetTitleAdjustRootBlipWithOneLineProperly(self):
self.blip._content = '\nOld title'
self.wavelet.title = 'New title'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals('\nNew title\n', self.blip._content)
def testSetTitleAdjustEmptyRootBlipProperly(self):
self.blip._content = '\n'
self.wavelet.title = 'New title'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals('\nNew title\n', self.blip._content)
def testTags(self):
w = self.wavelet
self.assertEquals(2, len(w.tags))
w.tags.append('tag3')
self.assertEquals(3, len(w.tags))
w.tags.append('tag3')
self.assertEquals(3, len(w.tags))
w.tags.remove('tag1')
self.assertEquals(2, len(w.tags))
self.assertEquals('tag2', w.tags[0])
def testParticipantRoles(self):
w = self.wavelet
self.assertEquals(wavelet.Participants.ROLE_FULL,
w.participants.get_role(ROBOT_NAME))
w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)
self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,
w.participants.get_role(ROBOT_NAME))
def testSerialize(self):
self.blip.append(element.Gadget('http://test.com', {'a': 3}))
self.wavelet.title = 'A wavelet title'
self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',
width=320, height=118))
self.blip.append(element.Attachment(caption='fake', data='fake data'))
self.blip.append(element.Line(line_type='li', indent='2'))
self.blip.append('bulleted!')
self.blip.append(element.Installer(
'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml'))
self.wavelet.proxy_for('proxy').reply().append('hi from douwe')
inlineBlip = self.blip.insert_inline_blip(5)
inlineBlip.append('hello again!')
serialized = self.wavelet.serialize()
serialized = simplejson.dumps(serialized)
self.assertTrue(serialized.find('test.com') > 0)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1116 | 103 | 177 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.096, 0.0056, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the wavelet module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.113, 0.0056, 0, 0.66, 0.0909, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L22_C0", "label": "blip import blip", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1243, 0.0056, 0, 0.66, 0.1818, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1299, 0.0056, 0, 0.66, 0.2727, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L24_C0", "label": "ops import ops", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1356, 0.0056, 0, 0.66, 0.3636, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L25_C0", "label": "wavelet import wavelet", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1412, 0.0056, 0, 0.66, 0.4545, 147, 0, 1, 0, 0, 147, 0, 0], "semantic": {"name": "wavelet", "arg_names": [], "import_names": ["wavelet"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Import_L27_C0", "label": "simplejson import simplejson", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1525, 0.0056, 0, 0.66, 0.5455, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L29_C0", "label": "ROBOT_NAME =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.1638, 0.0056, 0, 0.66, 0.6364, 987, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_NAME = 'robot@appspot.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L31_C0", "label": "TEST_WAVELET_DATA =", "type": "assigned_variable", "loc": [31, 42], "level": 0, "parent": null, "vector": [14, 0, 0.2062, 0.0678, 0, 0.66, 0.7273, 552, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_WAVELET_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_WAVELET_DATA = {\n 'creator': ROBOT_NAME,\n 'creationTime': 100,\n 'lastModifiedTime': 101,\n 'participants': [ROBOT_NAME],\n 'participantsRoles': {ROBOT_NAME: wavelet.Participants.ROLE_FULL},\n 'rootBlipId': 'blip-1',\n 'title': 'Title',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L44_C0", "label": "TEST_BLIP_DATA =", "type": "assigned_variable", "loc": [44, 55], "level": 0, "parent": null, "vector": [14, 0, 0.2797, 0.0678, 0, 0.66, 0.8182, 853, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_BLIP_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_BLIP_DATA = {\n 'blipId': TEST_WAVELET_DATA['rootBlipId'],\n 'childBlipIds': [],\n 'content': '\\ntesting',\n 'contributors': [TEST_WAVELET_DATA['creator'], 'robot@google.com'],\n 'creator': TEST_WAVELET_DATA['creator'],\n 'lastModifiedTime': TEST_WAVELET_DATA['lastModifiedTime'],\n 'parentBlipId': None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "label": "TestWavelet", "type": "class", "loc": [58, 174], "level": 0, "parent": null, "vector": [3, 0, 0.6554, 0.661, 0, 0.66, 0.9091, 610, 0, 9, 0, 0, 878, 0, 98], "semantic": {"name": "TestWavelet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestWavelet(unittest.TestCase):\n \"\"\"Tests the wavelet class.\"\"\"\n\n def setUp(self):\n self.operation_queue = ops.OperationQueue()\n self.all_blips = {}\n self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L59_C2", "label": "expression", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [8, 1, 0.3333, 0.0056, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests the wavelet class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "label": "setUp", "type": "function", "loc": [61, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.3757, 0.0678, 1, 0.7, 0.1111, 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 self.operation_queue = ops.OperationQueue()\n self.all_blips = {}\n self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,\n self.operation_queue)\n self.all_blips[self.blip.blip_id] = self.blip\n self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L62_C4", "label": "self.operation_queue = OperationQueue()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.3503, 0.0056, 2, 0.95, 0.0, 118, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "self.operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L63_C4", "label": "self.all_blips =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.3559, 0.0056, 2, 0.95, 0.2, 606, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.all_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L64_C4", "label": "self.blip = Blip()", "type": "assigned_variable", "loc": [64, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.3672, 0.0169, 2, 0.95, 0.4, 949, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "self.blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,\n self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L67_C4", "label": "assign", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.3785, 0.0056, 2, 0.95, 0.6, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips[self.blip.blip_id] = self.blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L68_C4", "label": "self.wavelet = Wavelet()", "type": "assigned_variable", "loc": [68, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.3927, 0.0226, 2, 0.95, 0.8, 288, 3, 4, 0, 0, 108, 10, 1], "semantic": {"name": "self.wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "Wavelet", "annotation": ""}, "snippet": " self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,\n self.all_blips,\n None,\n self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L72_C4", "label": "self.wavelet.robot_address =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "vector": [14, 2, 0.4068, 0.0056, 2, 0.95, 1.0, 641, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wavelet.robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.robot_address = ROBOT_NAME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "label": "testWaveletProperties", "type": "function", "loc": [74, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.4548, 0.0791, 1, 0.7, 0.2222, 17, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testWaveletProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWaveletProperties(self):\n w = self.wavelet\n self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)\n self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)\n self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],\n w.last_modified_time)\n self.assertEquals(len(TEST_WAVELET_DATA['participants']),\n len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L75_C4", "label": "w =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [14, 2, 0.4237, 0.0056, 2, 0.77, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L76_C4", "label": "assertEquals()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4294, 0.0056, 2, 0.77, 0.1, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L77_C4", "label": "assertEquals()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.435, 0.0056, 2, 0.77, 0.2, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4435, 0.0113, 2, 0.77, 0.3, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],\n w.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L80_C4", "label": "assertEquals()", "type": "expression", "loc": [80, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4548, 0.0113, 2, 0.77, 0.4, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(TEST_WAVELET_DATA['participants']),\n len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L82_C4", "label": "assertTrue()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4633, 0.0056, 2, 0.77, 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(TEST_WAVELET_DATA['participants'][0] in w.participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4689, 0.0056, 2, 0.77, 0.6, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['rootBlipId'], w.root_blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L84_C4", "label": "assertEquals()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4746, 0.0056, 2, 0.77, 0.7, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['title'], w.title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L85_C4", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4802, 0.0056, 2, 0.77, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['waveId'], w.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4859, 0.0056, 2, 0.77, 0.9, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['waveletId'], w.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L87_C4", "label": "assertEquals()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "vector": [8, 2, 0.4915, 0.0056, 2, 0.77, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('test.com', w.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "label": "testWaveletMethods", "type": "function", "loc": [89, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.5678, 0.1356, 1, 0.7, 0.3333, 823, 0, 1, 0, 0, 0, 0, 31], "semantic": {"name": "testWaveletMethods", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWaveletMethods(self):\n w = self.wavelet\n reply = w.reply()\n self.assertEquals(2, len(w.blips))\n w.delete(reply)\n self.assertEquals(1, len(w.blips))\n self.assertEquals(0, len(w.data_documents))\n self.wavelet.data_documents['key'] = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L90_C4", "label": "w =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.5085, 0.0056, 2, 0.06, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L91_C4", "label": "reply = reply()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.5141, 0.0056, 2, 0.06, 0.05, 714, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " reply = w.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L92_C4", "label": "assertEquals()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5198, 0.0056, 2, 0.06, 0.1, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L93_C4", "label": "delete()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5254, 0.0056, 2, 0.06, 0.15, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " w.delete(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L94_C4", "label": "assertEquals()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5311, 0.0056, 2, 0.06, 0.2, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5367, 0.0056, 2, 0.06, 0.25, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L96_C4", "label": "assign", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.5424, 0.0056, 2, 0.06, 0.3, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.data_documents['key'] = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L97_C4", "label": "assert_()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.548, 0.0056, 2, 0.06, 0.35, 17, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assert_", "arg_names": [], "import_names": [], "rhs_call_name": "assert_", "annotation": ""}, "snippet": " self.assert_('key' in w.data_documents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L98_C4", "label": "assertEquals()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5537, 0.0056, 2, 0.06, 0.4, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:For_L99_C4", "label": "for key", "type": "for", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [6, 2, 0.5621, 0.0113, 2, 0.06, 0.45, 230, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in w.data_documents:\n self.assertEquals(key, 'key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L100_C6", "label": "assertEquals()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:For_L99_C4", "vector": [8, 3, 0.565, 0.0056, 3, 0.83, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(key, 'key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L101_C4", "label": "assertEquals()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5706, 0.0056, 2, 0.06, 0.5, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.data_documents.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L102_C4", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.5763, 0.0056, 2, 0.06, 0.55, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.data_documents['key'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L103_C4", "label": "assertEquals()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5819, 0.0056, 2, 0.06, 0.6, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L104_C4", "label": "num_participants = len()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.5876, 0.0056, 2, 0.06, 0.65, 484, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "num_participants", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " num_participants = len(w.participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L105_C4", "label": "reply()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5932, 0.0056, 2, 0.06, 0.7, 714, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " w.proxy_for('proxy').reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.5989, 0.0056, 2, 0.06, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.6102, 0.0056, 2, 0.06, 0.8, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(num_participants + 1, len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L109_C4", "label": "w._robot_address = replace()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [14, 2, 0.6158, 0.0056, 2, 0.06, 0.85, 415, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "w._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " w._robot_address = ROBOT_NAME.replace('@', '+proxy@')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L110_C4", "label": "reply()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.6215, 0.0056, 2, 0.06, 0.9, 714, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " w.proxy_for('proxy').reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L111_C4", "label": "assertEquals()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.6271, 0.0056, 2, 0.06, 0.95, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(num_participants + 1, len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L112_C4", "label": "assertEquals()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "vector": [8, 2, 0.6328, 0.0056, 2, 0.06, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "label": "testSetTitle", "type": "function", "loc": [114, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.6638, 0.0452, 1, 0.7, 0.4444, 813, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitle", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitle(self):\n self.blip._content = '\\nOld title\\n\\nContent'\n self.wavelet.title = 'New title \\xd0\\xb0\\xd0\\xb1\\xd0\\xb2'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals(u'\\nNew title \\u0430\\u0431\\u0432\\n\\nContent',\n self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L115_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "vector": [14, 2, 0.6497, 0.0056, 2, 0.56, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\nOld title\\n\\nContent'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L116_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "vector": [14, 2, 0.6554, 0.0056, 2, 0.56, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title \\xd0\\xb0\\xd0\\xb1\\xd0\\xb2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L117_C4", "label": "assertEquals()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "vector": [8, 2, 0.661, 0.0056, 2, 0.56, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L118_C4", "label": "assertEquals()", "type": "expression", "loc": [118, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "vector": [8, 2, 0.6695, 0.0113, 2, 0.56, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L120_C4", "label": "assertEquals()", "type": "expression", "loc": [120, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "vector": [8, 2, 0.6808, 0.0113, 2, 0.56, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u'\\nNew title \\u0430\\u0431\\u0432\\n\\nContent',\n self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "label": "testSetTitleAdjustRootBlipWithOneLineProperly", "type": "function", "loc": [123, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.7119, 0.0395, 1, 0.7, 0.5556, 4, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitleAdjustRootBlipWithOneLineProperly", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitleAdjustRootBlipWithOneLineProperly(self):\n self.blip._content = '\\nOld title'\n self.wavelet.title = 'New title'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L124_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "vector": [14, 2, 0.7006, 0.0056, 2, 0.25, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\nOld title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L125_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "vector": [14, 2, 0.7062, 0.0056, 2, 0.25, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L126_C4", "label": "assertEquals()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "vector": [8, 2, 0.7119, 0.0056, 2, 0.25, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L127_C4", "label": "assertEquals()", "type": "expression", "loc": [127, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "vector": [8, 2, 0.7203, 0.0113, 2, 0.25, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L129_C4", "label": "assertEquals()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "vector": [8, 2, 0.7288, 0.0056, 2, 0.25, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "label": "testSetTitleAdjustEmptyRootBlipProperly", "type": "function", "loc": [131, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.7571, 0.0395, 1, 0.7, 0.6667, 395, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitleAdjustEmptyRootBlipProperly", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitleAdjustEmptyRootBlipProperly(self):\n self.blip._content = '\\n'\n self.wavelet.title = 'New title'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L132_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "vector": [14, 2, 0.7458, 0.0056, 2, 0.9, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L133_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "vector": [14, 2, 0.7514, 0.0056, 2, 0.9, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L134_C4", "label": "assertEquals()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "vector": [8, 2, 0.7571, 0.0056, 2, 0.9, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L135_C4", "label": "assertEquals()", "type": "expression", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "vector": [8, 2, 0.7655, 0.0113, 2, 0.9, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L137_C4", "label": "assertEquals()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "vector": [8, 2, 0.774, 0.0056, 2, 0.9, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "label": "testTags", "type": "function", "loc": [139, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.8107, 0.0565, 1, 0.7, 0.7778, 240, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testTags", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testTags(self):\n w = self.wavelet\n self.assertEquals(2, len(w.tags))\n w.tags.append('tag3')\n self.assertEquals(3, len(w.tags))\n w.tags.append('tag3')\n self.assertEquals(3, len(w.tags))\n w.tags.remove('tag1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L140_C4", "label": "w =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [14, 2, 0.791, 0.0056, 2, 0.86, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.7966, 0.0056, 2, 0.86, 0.125, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L142_C4", "label": "append()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8023, 0.0056, 2, 0.86, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " w.tags.append('tag3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L143_C4", "label": "assertEquals()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8079, 0.0056, 2, 0.86, 0.375, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L144_C4", "label": "append()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8136, 0.0056, 2, 0.86, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " w.tags.append('tag3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8192, 0.0056, 2, 0.86, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L146_C4", "label": "remove()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8249, 0.0056, 2, 0.86, 0.75, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " w.tags.remove('tag1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L147_C4", "label": "assertEquals()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8305, 0.0056, 2, 0.86, 0.875, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L148_C4", "label": "assertEquals()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "vector": [8, 2, 0.8362, 0.0056, 2, 0.86, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('tag2', w.tags[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "label": "testParticipantRoles", "type": "function", "loc": [150, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.8644, 0.0395, 1, 0.7, 0.8889, 766, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testParticipantRoles", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testParticipantRoles(self):\n w = self.wavelet\n self.assertEquals(wavelet.Participants.ROLE_FULL,\n w.participants.get_role(ROBOT_NAME))\n w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)\n self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L151_C4", "label": "w =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "vector": [14, 2, 0.8531, 0.0056, 2, 0.52, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L152_C4", "label": "assertEquals()", "type": "expression", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "vector": [8, 2, 0.8616, 0.0113, 2, 0.52, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.Participants.ROLE_FULL,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L154_C4", "label": "set_role()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "vector": [8, 2, 0.8701, 0.0056, 2, 0.52, 0.6667, 497, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_role", "arg_names": [], "import_names": [], "rhs_call_name": "set_role", "annotation": ""}, "snippet": " w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L155_C4", "label": "assertEquals()", "type": "expression", "loc": [155, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "vector": [8, 2, 0.8785, 0.0113, 2, 0.52, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "label": "testSerialize", "type": "function", "loc": [158, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "vector": [2, 1, 0.9379, 0.096, 1, 0.7, 1.0, 465, 0, 1, 0, 0, 0, 0, 20], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n self.blip.append(element.Gadget('http://test.com', {'a': 3}))\n self.wavelet.title = 'A wavelet title'\n self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',\n width=320, height=118))\n self.blip.append(element.Attachment(caption='fake', data='fake data'))\n self.blip.append(element.Line(line_type='li', indent='2'))\n self.blip.append('bulleted!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L159_C4", "label": "append()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.8983, 0.0056, 2, 0.83, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Gadget('http://test.com', {'a': 3}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L160_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [14, 2, 0.904, 0.0056, 2, 0.83, 0.0833, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'A wavelet title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L161_C4", "label": "append()", "type": "expression", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9124, 0.0113, 2, 0.83, 0.1667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',\n width=320, height=118))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L163_C4", "label": "append()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9209, 0.0056, 2, 0.83, 0.25, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Attachment(caption='fake', data='fake data'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L164_C4", "label": "append()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9266, 0.0056, 2, 0.83, 0.3333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Line(line_type='li', indent='2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L165_C4", "label": "append()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9322, 0.0056, 2, 0.83, 0.4167, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append('bulleted!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L166_C4", "label": "append()", "type": "expression", "loc": [166, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9407, 0.0113, 2, 0.83, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Installer(\n 'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L168_C4", "label": "append()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9492, 0.0056, 2, 0.83, 0.5833, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.wavelet.proxy_for('proxy').reply().append('hi from douwe')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L169_C4", "label": "inlineBlip = insert_inline_blip()", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [14, 2, 0.9548, 0.0056, 2, 0.83, 0.6667, 489, 3, 1, 0, 0, 203, 10, 1], "semantic": {"name": "inlineBlip", "arg_names": [], "import_names": [], "rhs_call_name": "insert_inline_blip", "annotation": ""}, "snippet": " inlineBlip = self.blip.insert_inline_blip(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L170_C4", "label": "append()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9605, 0.0056, 2, 0.83, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " inlineBlip.append('hello again!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L172_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [14, 2, 0.9718, 0.0056, 2, 0.83, 0.8333, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = self.wavelet.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L173_C4", "label": "serialized = dumps()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [14, 2, 0.9774, 0.0056, 2, 0.83, 0.9167, 280, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " serialized = simplejson.dumps(serialized)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L174_C4", "label": "assertTrue()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "vector": [8, 2, 0.9831, 0.0056, 2, 0.83, 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(serialized.find('test.com') > 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:If_L176_C0", "label": "if", "type": "if", "loc": [176, 177], "level": 0, "parent": null, "vector": [4, 0, 0.9972, 0.0113, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L177_C2", "label": "main()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1116:If_L176_C0", "vector": [8, 1, 1.0, 0.0056, 1, 0.5, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:For_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:For_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1116:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1116:Expr_L177_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains various API-specific exception classes.
This module contains various specific exception classes that are raised by
the library back to the client.
"""
class Error(Exception):
"""Base library error type."""
| ajibawa-2023/Python-Code-Large/train/row_1117 | 3 | 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_1117:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.76, 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": "\"\"\"Contains various API-specific exception classes.\n\nThis module contains various specific exception classes that are raised by\nthe library back to the client.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1117:ClassDef_L24_C0", "label": "Error", "type": "class", "loc": [24, 25], "level": 0, "parent": null, "vector": [3, 0, 0.98, 0.08, 0, 0.66, 1.0, 529, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "Error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Error(Exception):\n \"\"\"Base library error type.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1117:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1117:ClassDef_L24_C0", "vector": [8, 1, 1.0, 0.04, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Base library error type.\"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1117:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1117:Expr_L25_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Defines classes that are needed to model a wavelet."""
import blip
import errors
import util
class DataDocs(object):
"""Class modeling a bunch of data documents in pythonic way."""
def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):
self._docs = init_docs
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __iter__(self):
return self._docs.__iter__()
def __contains__(self, key):
return key in self._docs
def __delitem__(self, key):
if not key in self._docs:
return
self._operation_queue.wavelet_datadoc_set(
self._wave_id, self._wavelet_id, key, None)
del self._docs[key]
def __getitem__(self, key):
return self._docs[key]
def __setitem__(self, key, value):
self._operation_queue.wavelet_datadoc_set(
self._wave_id, self._wavelet_id, key, value)
if value is None and key in self._docs:
del self._docs[key]
else:
self._docs[key] = value
def __len__(self):
return len(self._docs)
def keys(self):
return self._docs.keys()
def serialize(self):
"""Returns a dictionary of the data documents."""
return self._docs
class Participants(object):
"""Class modelling a set of participants in pythonic way."""
#: Designates full access (read/write) role.
ROLE_FULL = "FULL"
#: Designates read-only role.
ROLE_READ_ONLY = "READ_ONLY"
def __init__(self, participants, roles, wave_id, wavelet_id, operation_queue):
self._participants = set(participants)
self._roles = roles.copy()
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __contains__(self, participant):
return participant in self._participants
def __len__(self):
return len(self._participants)
def __iter__(self):
return self._participants.__iter__()
def add(self, participant_id):
"""Adds a participant by their ID (address)."""
self._operation_queue.wavelet_add_participant(
self._wave_id, self._wavelet_id, participant_id)
self._participants.add(participant_id)
def get_role(self, participant_id):
"""Return the role for the given participant_id."""
return self._roles.get(participant_id, Participants.ROLE_FULL)
def set_role(self, participant_id, role):
"""Sets the role for the given participant_id."""
if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:
raise ValueError(role + ' is not a valid role')
self._operation_queue.wavelet_modify_participant_role(
self._wave_id, self._wavelet_id, participant_id, role)
self._roles[participant_id] = role
def serialize(self):
"""Returns a list of the participants."""
return list(self._participants)
class Tags(object):
"""Class modelling a list of tags."""
def __init__(self, tags, wave_id, wavelet_id, operation_queue):
self._tags = list(tags)
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __getitem__(self, index):
return self._tags[index]
def __len__(self):
return len(self._tags)
def __iter__(self):
return self._tags.__iter__()
def append(self, tag):
"""Appends a tag if it doesn't already exist."""
tag = util.force_unicode(tag)
if tag in self._tags:
return
self._operation_queue.wavelet_modify_tag(
self._wave_id, self._wavelet_id, tag)
self._tags.append(tag)
def remove(self, tag):
"""Removes a tag if it exists."""
tag = util.force_unicode(tag)
if not tag in self._tags:
return
self._operation_queue.wavelet_modify_tag(
self._wave_id, self._wavelet_id, tag, modify_how='remove')
self._tags.remove(tag)
def serialize(self):
"""Returns a list of tags."""
return list(self._tags)
class Wavelet(object):
"""Models a single wavelet.
A single wavelet is composed of metadata, participants, and its blips.
To guarantee that all blips are available, specify Context.ALL for events.
"""
def __init__(self, json, blips, robot, operation_queue):
"""Inits this wavelet with JSON data.
Args:
json: JSON data dictionary from Wave server.
blips: a dictionary object that can be used to resolve blips.
robot: the robot owning this wavelet.
operation_queue: an OperationQueue object to be used to
send any generated operations to.
"""
self._robot = robot
self._operation_queue = operation_queue
self._wave_id = json.get('waveId')
self._wavelet_id = json.get('waveletId')
self._creator = json.get('creator')
self._creation_time = json.get('creationTime', 0)
self._data_documents = DataDocs(json.get('dataDocuments', {}),
self._wave_id,
self._wavelet_id,
operation_queue)
self._last_modified_time = json.get('lastModifiedTime')
self._participants = Participants(json.get('participants', []),
json.get('participantRoles', {}),
self._wave_id,
self._wavelet_id,
operation_queue)
self._title = json.get('title', '')
self._tags = Tags(json.get('tags', []),
self._wave_id,
self._wavelet_id,
operation_queue)
self._raw_data = json
self._blips = blip.Blips(blips)
self._root_blip_id = json.get('rootBlipId')
if self._root_blip_id and self._root_blip_id in self._blips:
self._root_blip = self._blips[self._root_blip_id]
else:
self._root_blip = None
self._robot_address = None
@property
def wavelet_id(self):
"""Returns this wavelet's id."""
return self._wavelet_id
@property
def wave_id(self):
"""Returns this wavelet's parent wave id."""
return self._wave_id
@property
def creator(self):
"""Returns the participant id of the creator of this wavelet."""
return self._creator
@property
def creation_time(self):
"""Returns the time that this wavelet was first created in milliseconds."""
return self._creation_time
@property
def data_documents(self):
"""Returns the data documents for this wavelet based on key name."""
return self._data_documents
@property
def domain(self):
"""Return the domain that wavelet belongs to."""
p = self._wave_id.find('!')
if p == -1:
return None
else:
return self._wave_id[:p]
@property
def last_modified_time(self):
"""Returns the time that this wavelet was last modified in ms."""
return self._last_modified_time
@property
def participants(self):
"""Returns a set of participants on this wavelet."""
return self._participants
@property
def tags(self):
"""Returns a list of tags for this wavelet."""
return self._tags
@property
def robot(self):
"""The robot that owns this wavelet."""
return self._robot
def _get_title(self):
return self._title
def _set_title(self, title):
title = util.force_unicode(title)
if title.find('\n') != -1:
raise errors.Error('Wavelet title should not contain a newline ' +
'character. Specified: ' + title)
self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,
title)
self._title = title
# Adjust the content of the root blip, if it is available in the context.
if self._root_blip:
content = '\n'
splits = self._root_blip._content.split('\n', 2)
if len(splits) == 3:
content += splits[2]
self._root_blip._content = '\n' + title + content
#: Returns or sets the wavelet's title.
title = property(_get_title, _set_title,
doc='Get or set the title of the wavelet.')
def _get_robot_address(self):
return self._robot_address
def _set_robot_address(self, address):
if self._robot_address:
raise errors.Error('robot address already set')
self._robot_address = address
robot_address = property(_get_robot_address, _set_robot_address,
doc='Get or set the address of the current robot.')
@property
def root_blip(self):
"""Returns this wavelet's root blip."""
return self._root_blip
@property
def blips(self):
"""Returns the blips for this wavelet."""
return self._blips
def get_operation_queue(self):
"""Returns the OperationQueue for this wavelet."""
return self._operation_queue
def serialize(self):
"""Return a dict of the wavelet properties."""
return {'waveId': self._wave_id,
'waveletId': self._wavelet_id,
'creator': self._creator,
'creationTime': self._creation_time,
'dataDocuments': self._data_documents.serialize(),
'lastModifiedTime': self._last_modified_time,
'participants': self._participants.serialize(),
'title': self._title,
'blips': self._blips.serialize(),
'rootBlipId': self._root_blip_id
}
def proxy_for(self, proxy_for_id):
"""Return a view on this wavelet that will proxy for the specified id.
A shallow copy of the current wavelet is returned with the proxy_for_id
set. Any modifications made to this copy will be done using the
proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will
be used.
If the wavelet was retrieved using the Active Robot API, that is
by fetch_wavelet, then the address of the robot must be added to the
wavelet by setting wavelet.robot_address before calling proxy_for().
"""
self.add_proxying_participant(proxy_for_id)
operation_queue = self.get_operation_queue().proxy_for(proxy_for_id)
res = Wavelet(json={},
blips={},
robot=self.robot,
operation_queue=operation_queue)
res._wave_id = self._wave_id
res._wavelet_id = self._wavelet_id
res._creator = self._creator
res._creation_time = self._creation_time
res._data_documents = self._data_documents
res._last_modified_time = self._last_modified_time
res._participants = self._participants
res._title = self._title
res._raw_data = self._raw_data
res._blips = self._blips
res._root_blip = self._root_blip
return res
def add_proxying_participant(self, id):
"""Ads a proxying participant to the wave.
Proxying participants are of the form robot+proxy@domain.com. This
convenience method constructs this id and then calls participants.add.
"""
if not self.robot_address:
raise errors.Error(
'Need a robot address to add a proxying for participant')
robotid, domain = self.robot_address.split('@', 1)
if '#' in robotid:
robotid, version = robotid.split('#')
else:
version = None
if '+' in robotid:
newid = robotid.split('+', 1)[0] + '+' + id
else:
newid = robotid + '+' + id
if version:
newid += '#' + version
newid += '@' + domain
self.participants.add(newid)
def submit_with(self, other_wavelet):
"""Submit this wavelet when the passed other wavelet is submited.
wavelets constructed outside of the event callback need to
be either explicitly submited using robot.submit(wavelet) or be
associated with a different wavelet that will be submited or
is part of the event callback.
"""
other_wavelet._operation_queue.copy_operations(self._operation_queue)
self._operation_queue = other_wavelet._operation_queue
def reply(self, initial_content=None):
"""Replies to the conversation in this wavelet.
Args:
initial_content: If set, start with this (string) content.
Returns:
A transient version of the blip that contains the reply.
"""
if not initial_content:
initial_content = u'\n'
initial_content = util.force_unicode(initial_content)
blip_data = self._operation_queue.wavelet_append_blip(
self.wave_id, self.wavelet_id, initial_content)
instance = blip.Blip(blip_data, self._blips, self._operation_queue)
self._blips._add(instance)
return instance
def delete(self, todelete):
"""Remove a blip from this wavelet.
Args:
todelete: either a blip or a blip id to be removed.
"""
if isinstance(todelete, blip.Blip):
blip_id = todelete.blip_id
else:
blip_id = todelete
self._operation_queue.blip_delete(self.wave_id, self.wavelet_id, blip_id)
self._blips._remove_with_id(blip_id)
| ajibawa-2023/Python-Code-Large/train/row_1118 | 228 | 418 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0407, 0.0024, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Defines classes that are needed to model a wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Import_L19_C0", "label": "blip import blip", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0024, 0, 0.66, 0.1429, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Import_L20_C0", "label": "errors import errors", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0478, 0.0024, 0, 0.66, 0.2857, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Import_L21_C0", "label": "util import util", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0502, 0.0024, 0, 0.66, 0.4286, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "label": "DataDocs", "type": "class", "loc": [24, 65], "level": 0, "parent": null, "vector": [3, 0, 0.1065, 0.1005, 0, 0.66, 0.5714, 119, 0, 9, 0, 0, 186, 0, 5], "semantic": {"name": "DataDocs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DataDocs(object):\n \"\"\"Class modeling a bunch of data documents in pythonic way.\"\"\"\n\n def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):\n self._docs = init_docs\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [8, 1, 0.0598, 0.0024, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modeling a bunch of data documents in pythonic way.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "label": "__init__", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.0694, 0.012, 1, 0.51, 0.1111, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "init_docs", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):\n self._docs = init_docs\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L28_C4", "label": "self._docs =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "vector": [14, 2, 0.067, 0.0024, 2, 0.94, 0.0, 879, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._docs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._docs = init_docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L29_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "vector": [14, 2, 0.0694, 0.0024, 2, 0.94, 0.3333, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L30_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "vector": [14, 2, 0.0718, 0.0024, 2, 0.94, 0.6667, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L31_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "vector": [14, 2, 0.0742, 0.0024, 2, 0.94, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L33_C2", "label": "__iter__", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.0801, 0.0048, 1, 0.51, 0.2222, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._docs.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L33_C2", "vector": [13, 2, 0.0813, 0.0024, 2, 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._docs.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L36_C2", "label": "__contains__", "type": "function", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.0873, 0.0048, 1, 0.51, 0.3333, 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._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L36_C2", "vector": [13, 2, 0.0885, 0.0024, 2, 0.11, 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._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2", "label": "__delitem__", "type": "function", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.0993, 0.0144, 1, 0.51, 0.4444, 66, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__delitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, key):\n if not key in self._docs:\n return\n self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, None)\n del self._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L40_C4", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2", "vector": [4, 2, 0.0969, 0.0048, 2, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not key in self._docs:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L41_C6", "label": "return", "type": "return", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L40_C4", "vector": [13, 3, 0.0981, 0.0024, 3, 0.54, 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_1118:Expr_L42_C4", "label": "wavelet_datadoc_set()", "type": "expression", "loc": [42, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2", "vector": [8, 2, 0.1017, 0.0048, 2, 0.72, 1.0, 590, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_datadoc_set", "annotation": ""}, "snippet": " self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L46_C2", "label": "__getitem__", "type": "function", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.1112, 0.0048, 1, 0.51, 0.5556, 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._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L46_C2", "vector": [13, 2, 0.1124, 0.0024, 2, 0.31, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2", "label": "__setitem__", "type": "function", "loc": [49, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.1244, 0.0167, 1, 0.51, 0.6667, 343, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, key, value):\n self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, value)\n if value is None and key in self._docs:\n del self._docs[key]\n else:\n self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L50_C4", "label": "wavelet_datadoc_set()", "type": "expression", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2", "vector": [8, 2, 0.1208, 0.0048, 2, 0.79, 0.0, 590, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_datadoc_set", "annotation": ""}, "snippet": " self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L52_C4", "label": "if", "type": "if", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2", "vector": [4, 2, 0.128, 0.0096, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None and key in self._docs:\n del self._docs[key]\n else:\n self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L55_C6", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L52_C4", "vector": [14, 3, 0.1316, 0.0024, 3, 0.26, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L57_C2", "label": "__len__", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.1376, 0.0048, 1, 0.51, 0.7778, 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 return len(self._docs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L57_C2", "vector": [13, 2, 0.1388, 0.0024, 2, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._docs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L60_C2", "label": "keys", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.1447, 0.0048, 1, 0.51, 0.8889, 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._docs.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L60_C2", "vector": [13, 2, 0.1459, 0.0024, 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._docs.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2", "label": "serialize", "type": "function", "loc": [63, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "vector": [2, 1, 0.1531, 0.0072, 1, 0.51, 1.0, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a dictionary of the data documents.\"\"\"\n return self._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L64_C4", "label": "expression", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2", "vector": [8, 2, 0.1531, 0.0024, 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 a dictionary of the data documents.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2", "vector": [13, 2, 0.1555, 0.0024, 2, 0.04, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "label": "Participants", "type": "class", "loc": [68, 113], "level": 0, "parent": null, "vector": [3, 0, 0.2165, 0.11, 0, 0.66, 0.7143, 0, 0, 8, 0, 0, 186, 0, 10], "semantic": {"name": "Participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Participants(object):\n \"\"\"Class modelling a set of participants in pythonic way.\"\"\"\n\n #: Designates full access (read/write) role.\n ROLE_FULL = \"FULL\"\n\n #: Designates read-only role.\n ROLE_READ_ONLY = \"READ_ONLY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L69_C2", "label": "expression", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [8, 1, 0.1651, 0.0024, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modelling a set of participants in pythonic way.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L72_C2", "label": "ROLE_FULL =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [14, 1, 0.1722, 0.0024, 1, 0.1, 0.1, 221, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROLE_FULL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROLE_FULL = \"FULL\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L75_C2", "label": "ROLE_READ_ONLY =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [14, 1, 0.1794, 0.0024, 1, 0.1, 0.2, 638, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROLE_READ_ONLY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROLE_READ_ONLY = \"READ_ONLY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "label": "__init__", "type": "function", "loc": [77, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.1902, 0.0144, 1, 0.1, 0.3, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "participants", "roles", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, participants, roles, wave_id, wavelet_id, operation_queue):\n self._participants = set(participants)\n self._roles = roles.copy()\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L78_C4", "label": "self._participants = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "vector": [14, 2, 0.1866, 0.0024, 2, 0.81, 0.0, 462, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "self._participants", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._participants = set(participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L79_C4", "label": "self._roles = copy()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "vector": [14, 2, 0.189, 0.0024, 2, 0.81, 0.25, 297, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "self._roles", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self._roles = roles.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L80_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "vector": [14, 2, 0.1914, 0.0024, 2, 0.81, 0.5, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L81_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "vector": [14, 2, 0.1938, 0.0024, 2, 0.81, 0.75, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L82_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "vector": [14, 2, 0.1962, 0.0024, 2, 0.81, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L84_C2", "label": "__contains__", "type": "function", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2022, 0.0048, 1, 0.1, 0.4, 456, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__contains__", "arg_names": ["self", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, participant):\n return participant in self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L85_C4", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L84_C2", "vector": [13, 2, 0.2033, 0.0024, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return participant in self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L87_C2", "label": "__len__", "type": "function", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2093, 0.0048, 1, 0.1, 0.5, 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 return len(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L88_C4", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L87_C2", "vector": [13, 2, 0.2105, 0.0024, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L90_C2", "label": "__iter__", "type": "function", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2165, 0.0048, 1, 0.1, 0.6, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._participants.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L90_C2", "vector": [13, 2, 0.2177, 0.0024, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._participants.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "label": "add", "type": "function", "loc": [93, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2273, 0.012, 1, 0.1, 0.7, 241, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": ["self", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, participant_id):\n \"\"\"Adds a participant by their ID (address).\"\"\"\n self._operation_queue.wavelet_add_participant(\n self._wave_id, self._wavelet_id, participant_id)\n self._participants.add(participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "vector": [8, 2, 0.2249, 0.0024, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Adds a participant by their ID (address).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L95_C4", "label": "wavelet_add_participant()", "type": "expression", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "vector": [8, 2, 0.2285, 0.0048, 2, 0.15, 0.5, 945, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_add_participant", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_add_participant", "annotation": ""}, "snippet": " self._operation_queue.wavelet_add_participant(\n self._wave_id, self._wavelet_id, participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L97_C4", "label": "add()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "vector": [8, 2, 0.2321, 0.0024, 2, 0.15, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self._participants.add(participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2", "label": "get_role", "type": "function", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2392, 0.0072, 1, 0.1, 0.8, 36, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_role", "arg_names": ["self", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_role(self, participant_id):\n \"\"\"Return the role for the given participant_id.\"\"\"\n return self._roles.get(participant_id, Participants.ROLE_FULL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L100_C4", "label": "expression", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2", "vector": [8, 2, 0.2392, 0.0024, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the role for the given participant_id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2", "vector": [13, 2, 0.2416, 0.0024, 2, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._roles.get(participant_id, Participants.ROLE_FULL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "label": "set_role", "type": "function", "loc": [103, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2536, 0.0167, 1, 0.1, 0.9, 497, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "set_role", "arg_names": ["self", "participant_id", "role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_role(self, participant_id, role):\n \"\"\"Sets the role for the given participant_id.\"\"\"\n if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:\n raise ValueError(role + ' is not a valid role')\n self._operation_queue.wavelet_modify_participant_role(\n self._wave_id, self._wavelet_id, participant_id, role)\n self._roles[participant_id] = role"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "vector": [8, 2, 0.2488, 0.0024, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets the role for the given participant_id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L105_C4", "label": "if", "type": "if", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "vector": [4, 2, 0.2524, 0.0048, 2, 0.34, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:\n raise ValueError(role + ' is not a valid role')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L107_C4", "label": "wavelet_modify_participant_role()", "type": "expression", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "vector": [8, 2, 0.2572, 0.0048, 2, 0.34, 0.6667, 163, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_participant_role", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_participant_role", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_participant_role(\n self._wave_id, self._wavelet_id, participant_id, role)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L109_C4", "label": "assign", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "vector": [14, 2, 0.2608, 0.0024, 2, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._roles[participant_id] = role"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2", "label": "serialize", "type": "function", "loc": [111, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "vector": [2, 1, 0.2679, 0.0072, 1, 0.1, 1.0, 50, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a list of the participants.\"\"\"\n return list(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L112_C4", "label": "expression", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2", "vector": [8, 2, 0.2679, 0.0024, 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 a list of the participants.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L113_C4", "label": "return", "type": "return", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2", "vector": [13, 2, 0.2703, 0.0024, 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 list(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "label": "Tags", "type": "class", "loc": [116, 153], "level": 0, "parent": null, "vector": [3, 0, 0.3218, 0.0909, 0, 0.66, 0.8571, 344, 0, 7, 0, 0, 186, 0, 10], "semantic": {"name": "Tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Tags(object):\n \"\"\"Class modelling a list of tags.\"\"\"\n def __init__(self, tags, wave_id, wavelet_id, operation_queue):\n self._tags = list(tags)\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L117_C2", "label": "expression", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [8, 1, 0.2799, 0.0024, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modelling a list of tags.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "label": "__init__", "type": "function", "loc": [118, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.2871, 0.012, 1, 0.17, 0.1429, 555, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "tags", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, tags, wave_id, wavelet_id, operation_queue):\n self._tags = list(tags)\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L119_C4", "label": "self._tags = list()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "vector": [14, 2, 0.2847, 0.0024, 2, 0.71, 0.0, 55, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self._tags", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self._tags = list(tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L120_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "vector": [14, 2, 0.2871, 0.0024, 2, 0.71, 0.3333, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L121_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "vector": [14, 2, 0.2895, 0.0024, 2, 0.71, 0.6667, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L122_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "vector": [14, 2, 0.2919, 0.0024, 2, 0.71, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L124_C2", "label": "__getitem__", "type": "function", "loc": [124, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.2978, 0.0048, 1, 0.17, 0.2857, 698, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n return self._tags[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L124_C2", "vector": [13, 2, 0.299, 0.0024, 2, 0.85, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tags[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L127_C2", "label": "__len__", "type": "function", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.305, 0.0048, 1, 0.17, 0.4286, 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 return len(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L128_C4", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L127_C2", "vector": [13, 2, 0.3062, 0.0024, 2, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L130_C2", "label": "__iter__", "type": "function", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.3122, 0.0048, 1, 0.17, 0.5714, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._tags.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L131_C4", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L130_C2", "vector": [13, 2, 0.3134, 0.0024, 2, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tags.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "label": "append", "type": "function", "loc": [133, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.3266, 0.0191, 1, 0.17, 0.7143, 243, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": ["self", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, tag):\n \"\"\"Appends a tag if it doesn't already exist.\"\"\"\n tag = util.force_unicode(tag)\n if tag in self._tags:\n return\n self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag)\n self._tags.append(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L134_C4", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "vector": [8, 2, 0.3206, 0.0024, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends a tag if it doesn't already exist.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L135_C4", "label": "tag = force_unicode()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "vector": [14, 2, 0.323, 0.0024, 2, 0.27, 0.25, 732, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " tag = util.force_unicode(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L136_C4", "label": "if", "type": "if", "loc": [136, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "vector": [4, 2, 0.3266, 0.0048, 2, 0.27, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in self._tags:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L137_C6", "label": "return", "type": "return", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L136_C4", "vector": [13, 3, 0.3278, 0.0024, 3, 0.57, 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_1118:Expr_L138_C4", "label": "wavelet_modify_tag()", "type": "expression", "loc": [138, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "vector": [8, 2, 0.3313, 0.0048, 2, 0.27, 0.75, 271, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_tag", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L140_C4", "label": "append()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "vector": [8, 2, 0.3349, 0.0024, 2, 0.27, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._tags.append(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "label": "remove", "type": "function", "loc": [142, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.3481, 0.0191, 1, 0.17, 0.8571, 185, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "remove", "arg_names": ["self", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove(self, tag):\n \"\"\"Removes a tag if it exists.\"\"\"\n tag = util.force_unicode(tag)\n if not tag in self._tags:\n return\n self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag, modify_how='remove')\n self._tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L143_C4", "label": "expression", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "vector": [8, 2, 0.3421, 0.0024, 2, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Removes a tag if it exists.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L144_C4", "label": "tag = force_unicode()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "vector": [14, 2, 0.3445, 0.0024, 2, 0.61, 0.25, 732, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " tag = util.force_unicode(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L145_C4", "label": "if", "type": "if", "loc": [145, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "vector": [4, 2, 0.3481, 0.0048, 2, 0.61, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not tag in self._tags:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L146_C6", "label": "return", "type": "return", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L145_C4", "vector": [13, 3, 0.3493, 0.0024, 3, 0.6, 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_1118:Expr_L147_C4", "label": "wavelet_modify_tag()", "type": "expression", "loc": [147, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "vector": [8, 2, 0.3529, 0.0048, 2, 0.61, 0.75, 271, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_tag", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag, modify_how='remove')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L149_C4", "label": "remove()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "vector": [8, 2, 0.3565, 0.0024, 2, 0.61, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self._tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2", "label": "serialize", "type": "function", "loc": [151, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "vector": [2, 1, 0.3636, 0.0072, 1, 0.17, 1.0, 50, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a list of tags.\"\"\"\n return list(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L152_C4", "label": "expression", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2", "vector": [8, 2, 0.3636, 0.0024, 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 a list of tags.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L153_C4", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2", "vector": [13, 2, 0.366, 0.0024, 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 list(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "label": "Wavelet", "type": "class", "loc": [156, 418], "level": 0, "parent": null, "vector": [3, 0, 0.6866, 0.6292, 0, 0.66, 1.0, 108, 0, 24, 0, 0, 186, 0, 45], "semantic": {"name": "Wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Wavelet(object):\n \"\"\"Models a single wavelet.\n\n A single wavelet is composed of metadata, participants, and its blips.\n To guarantee that all blips are available, specify Context.ALL for events.\n \"\"\"\n\n def __init__(self, json, blips, robot, operation_queue):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L157_C2", "label": "expression", "type": "expression", "loc": [157, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [8, 1, 0.3804, 0.012, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models a single wavelet.\n\n A single wavelet is composed of metadata, participants, and its blips.\n To guarantee that all blips are available, specify Context.ALL for events.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "label": "__init__", "type": "function", "loc": [163, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.4366, 0.0957, 1, 0.87, 0.0385, 555, 0, 5, 0, 0, 0, 0, 15], "semantic": {"name": "__init__", "arg_names": ["self", "json", "blips", "robot", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, blips, robot, operation_queue):\n \"\"\"Inits this wavelet with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n blips: a dictionary object that can be used to resolve blips.\n robot: the robot owning this wavelet.\n operation_queue: an OperationQueue object to be used to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L164_C4", "label": "expression", "type": "expression", "loc": [164, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [8, 2, 0.4019, 0.0215, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this wavelet with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n blips: a dictionary object that can be used to resolve blips.\n robot: the robot owning this wavelet.\n operation_queue: an OperationQueue object to be used to\n send any generated operations to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L173_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4139, 0.0024, 2, 0.53, 0.0625, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L174_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4163, 0.0024, 2, 0.53, 0.125, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L175_C4", "label": "self._wave_id = get()", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4187, 0.0024, 2, 0.53, 0.1875, 26, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wave_id = json.get('waveId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L176_C4", "label": "self._wavelet_id = get()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4211, 0.0024, 2, 0.53, 0.25, 575, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wavelet_id = json.get('waveletId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L177_C4", "label": "self._creator = get()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4234, 0.0024, 2, 0.53, 0.3125, 777, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._creator", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creator = json.get('creator')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L178_C4", "label": "self._creation_time = get()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4258, 0.0024, 2, 0.53, 0.375, 128, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._creation_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creation_time = json.get('creationTime', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L179_C4", "label": "self._data_documents = DataDocs()", "type": "assigned_variable", "loc": [179, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4318, 0.0096, 2, 0.53, 0.4375, 408, 3, 4, 0, 0, 119, 10, 2], "semantic": {"name": "self._data_documents", "arg_names": [], "import_names": [], "rhs_call_name": "DataDocs", "annotation": ""}, "snippet": " self._data_documents = DataDocs(json.get('dataDocuments', {}),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L183_C4", "label": "self._last_modified_time = get()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4378, 0.0024, 2, 0.53, 0.5, 351, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._last_modified_time = json.get('lastModifiedTime')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L184_C4", "label": "self._participants = Participants()", "type": "assigned_variable", "loc": [184, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.445, 0.012, 2, 0.53, 0.5625, 462, 3, 5, 0, 0, 0, 10, 3], "semantic": {"name": "self._participants", "arg_names": [], "import_names": [], "rhs_call_name": "Participants", "annotation": ""}, "snippet": " self._participants = Participants(json.get('participants', []),\n json.get('participantRoles', {}),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L189_C4", "label": "self._title = get()", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4522, 0.0024, 2, 0.53, 0.625, 209, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._title", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._title = json.get('title', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L190_C4", "label": "self._tags = Tags()", "type": "assigned_variable", "loc": [190, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4581, 0.0096, 2, 0.53, 0.6875, 55, 3, 4, 0, 0, 344, 10, 2], "semantic": {"name": "self._tags", "arg_names": [], "import_names": [], "rhs_call_name": "Tags", "annotation": ""}, "snippet": " self._tags = Tags(json.get('tags', []),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L195_C4", "label": "self._raw_data =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4665, 0.0024, 2, 0.53, 0.75, 496, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L196_C4", "label": "self._blips = Blips()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4689, 0.0024, 2, 0.53, 0.8125, 720, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "self._blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " self._blips = blip.Blips(blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L197_C4", "label": "self._root_blip_id = get()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4713, 0.0024, 2, 0.53, 0.875, 450, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._root_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._root_blip_id = json.get('rootBlipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4", "label": "if", "type": "if", "loc": [198, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [4, 2, 0.4773, 0.0096, 2, 0.53, 0.9375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._root_blip_id and self._root_blip_id in self._blips:\n self._root_blip = self._blips[self._root_blip_id]\n else:\n self._root_blip = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L199_C6", "label": "self._root_blip =", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4", "vector": [14, 3, 0.4761, 0.0024, 3, 0.07, 0.0, 895, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip = self._blips[self._root_blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L201_C6", "label": "self._root_blip =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4", "vector": [14, 3, 0.4809, 0.0024, 3, 0.07, 1.0, 895, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L202_C4", "label": "self._robot_address =", "type": "assigned_variable", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "vector": [14, 2, 0.4833, 0.0024, 2, 0.53, 1.0, 195, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot_address = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2", "label": "wavelet_id", "type": "function", "loc": [205, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.4928, 0.0072, 1, 0.87, 0.0769, 269, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_id(self):\n \"\"\"Returns this wavelet's id.\"\"\"\n return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L206_C4", "label": "expression", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2", "vector": [8, 2, 0.4928, 0.0024, 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 this wavelet's id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L207_C4", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2", "vector": [13, 2, 0.4952, 0.0024, 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._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2", "label": "wave_id", "type": "function", "loc": [210, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5048, 0.0072, 1, 0.87, 0.1154, 347, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wave_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wave_id(self):\n \"\"\"Returns this wavelet's parent wave id.\"\"\"\n return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L211_C4", "label": "expression", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2", "vector": [8, 2, 0.5048, 0.0024, 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 this wavelet's parent wave id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L212_C4", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2", "vector": [13, 2, 0.5072, 0.0024, 2, 0.77, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2", "label": "creator", "type": "function", "loc": [215, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5167, 0.0072, 1, 0.87, 0.1538, 608, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creator(self):\n \"\"\"Returns the participant id of the creator of this wavelet.\"\"\"\n return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L216_C4", "label": "expression", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2", "vector": [8, 2, 0.5167, 0.0024, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns the participant id of the creator of this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L217_C4", "label": "return", "type": "return", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2", "vector": [13, 2, 0.5191, 0.0024, 2, 0.99, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2", "label": "creation_time", "type": "function", "loc": [220, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5287, 0.0072, 1, 0.87, 0.1923, 217, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creation_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creation_time(self):\n \"\"\"Returns the time that this wavelet was first created in milliseconds.\"\"\"\n return self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L221_C4", "label": "expression", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2", "vector": [8, 2, 0.5287, 0.0024, 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 time that this wavelet was first created in milliseconds.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L222_C4", "label": "return", "type": "return", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2", "vector": [13, 2, 0.5311, 0.0024, 2, 0.13, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2", "label": "data_documents", "type": "function", "loc": [225, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5407, 0.0072, 1, 0.87, 0.2308, 739, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "data_documents", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def data_documents(self):\n \"\"\"Returns the data documents for this wavelet based on key name.\"\"\"\n return self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L226_C4", "label": "expression", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2", "vector": [8, 2, 0.5407, 0.0024, 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 data documents for this wavelet based on key name.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L227_C4", "label": "return", "type": "return", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2", "vector": [13, 2, 0.5431, 0.0024, 2, 0.41, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "label": "domain", "type": "function", "loc": [230, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5574, 0.0167, 1, 0.87, 0.2692, 438, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "domain", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def domain(self):\n \"\"\"Return the domain that wavelet belongs to.\"\"\"\n p = self._wave_id.find('!')\n if p == -1:\n return None\n else:\n return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L231_C4", "label": "expression", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "vector": [8, 2, 0.5526, 0.0024, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the domain that wavelet belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L232_C4", "label": "p = find()", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "vector": [14, 2, 0.555, 0.0024, 2, 0.38, 0.5, 491, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " p = self._wave_id.find('!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4", "label": "if", "type": "if", "loc": [233, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "vector": [4, 2, 0.561, 0.0096, 2, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if p == -1:\n return None\n else:\n return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L234_C6", "label": "return", "type": "return", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4", "vector": [13, 3, 0.5598, 0.0024, 3, 0.98, 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_1118:Return_L236_C6", "label": "return", "type": "return", "loc": [236, 236], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4", "vector": [13, 3, 0.5646, 0.0024, 3, 0.98, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2", "label": "last_modified_time", "type": "function", "loc": [239, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5742, 0.0072, 1, 0.87, 0.3077, 538, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "last_modified_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def last_modified_time(self):\n \"\"\"Returns the time that this wavelet was last modified in ms.\"\"\"\n return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L240_C4", "label": "expression", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2", "vector": [8, 2, 0.5742, 0.0024, 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 time that this wavelet was last modified in ms.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L241_C4", "label": "return", "type": "return", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2", "vector": [13, 2, 0.5766, 0.0024, 2, 0.54, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2", "label": "participants", "type": "function", "loc": [244, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5861, 0.0072, 1, 0.87, 0.3462, 572, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "participants", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def participants(self):\n \"\"\"Returns a set of participants on this wavelet.\"\"\"\n return self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L245_C4", "label": "expression", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2", "vector": [8, 2, 0.5861, 0.0024, 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 a set of participants on this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L246_C4", "label": "return", "type": "return", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2", "vector": [13, 2, 0.5885, 0.0024, 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._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2", "label": "tags", "type": "function", "loc": [249, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.5981, 0.0072, 1, 0.87, 0.3846, 487, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "tags", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tags(self):\n \"\"\"Returns a list of tags for this wavelet.\"\"\"\n return self._tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L250_C4", "label": "expression", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2", "vector": [8, 2, 0.5981, 0.0024, 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 a list of tags for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L251_C4", "label": "return", "type": "return", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2", "vector": [13, 2, 0.6005, 0.0024, 2, 0.22, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2", "label": "robot", "type": "function", "loc": [254, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.61, 0.0072, 1, 0.87, 0.4231, 735, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "robot", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot(self):\n \"\"\"The robot that owns this wavelet.\"\"\"\n return self._robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L255_C4", "label": "expression", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2", "vector": [8, 2, 0.61, 0.0024, 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 robot that owns this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L256_C4", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2", "vector": [13, 2, 0.6124, 0.0024, 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._robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L258_C2", "label": "_get_title", "type": "function", "loc": [258, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.6184, 0.0048, 1, 0.87, 0.4615, 564, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_title", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_title(self):\n return self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L259_C4", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L258_C2", "vector": [13, 2, 0.6196, 0.0024, 2, 0.34, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "label": "_set_title", "type": "function", "loc": [261, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.6447, 0.0431, 1, 0.87, 0.5, 637, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_set_title", "arg_names": ["self", "title"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_title(self, title):\n title = util.force_unicode(title)\n\n if title.find('\\n') != -1:\n raise errors.Error('Wavelet title should not contain a newline ' +\n 'character. Specified: ' + title)\n\n self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L262_C4", "label": "title = force_unicode()", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "vector": [14, 2, 0.6268, 0.0024, 2, 0.15, 0.0, 48, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " title = util.force_unicode(title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L264_C4", "label": "if", "type": "if", "loc": [264, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "vector": [4, 2, 0.634, 0.0072, 2, 0.15, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if title.find('\\n') != -1:\n raise errors.Error('Wavelet title should not contain a newline ' +\n 'character. Specified: ' + title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L268_C4", "label": "wavelet_set_title()", "type": "expression", "loc": [268, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "vector": [8, 2, 0.6423, 0.0048, 2, 0.15, 0.5, 132, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_set_title", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_set_title", "annotation": ""}, "snippet": " self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,\n title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L270_C4", "label": "self._title =", "type": "assigned_variable", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "vector": [14, 2, 0.6459, 0.0024, 2, 0.15, 0.75, 209, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._title = title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "label": "if", "type": "if", "loc": [273, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "vector": [4, 2, 0.6591, 0.0144, 2, 0.15, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._root_blip:\n content = '\\n'\n splits = self._root_blip._content.split('\\n', 2)\n if len(splits) == 3:\n content += splits[2]\n self._root_blip._content = '\\n' + title + content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L274_C6", "label": "content =", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "vector": [14, 3, 0.6555, 0.0024, 3, 0.44, 0.0, 273, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L275_C6", "label": "splits = split()", "type": "assigned_variable", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "vector": [14, 3, 0.6579, 0.0024, 3, 0.44, 0.3333, 323, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "splits", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " splits = self._root_blip._content.split('\\n', 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L276_C6", "label": "if", "type": "if", "loc": [276, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "vector": [4, 3, 0.6615, 0.0048, 3, 0.44, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(splits) == 3:\n content += splits[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L278_C6", "label": "self._root_blip._content =", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "vector": [14, 3, 0.6651, 0.0024, 3, 0.44, 1.0, 705, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._root_blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip._content = '\\n' + title + content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L281_C2", "label": "title = property()", "type": "assigned_variable", "loc": [281, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [14, 1, 0.6734, 0.0048, 1, 0.87, 0.5385, 48, 3, 3, 0, 0, 244, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " title = property(_get_title, _set_title,\n doc='Get or set the title of the wavelet.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L284_C2", "label": "_get_robot_address", "type": "function", "loc": [284, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.6806, 0.0048, 1, 0.87, 0.5769, 416, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_robot_address", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_robot_address(self):\n return self._robot_address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L285_C4", "label": "return", "type": "return", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L284_C2", "vector": [13, 2, 0.6818, 0.0024, 2, 0.72, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._robot_address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2", "label": "_set_robot_address", "type": "function", "loc": [287, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.6902, 0.0096, 1, 0.87, 0.6154, 733, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_robot_address", "arg_names": ["self", "address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_robot_address(self, address):\n if self._robot_address:\n raise errors.Error('robot address already set')\n self._robot_address = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L288_C4", "label": "if", "type": "if", "loc": [288, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2", "vector": [4, 2, 0.6902, 0.0048, 2, 0.12, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._robot_address:\n raise errors.Error('robot address already set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L290_C4", "label": "self._robot_address =", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2", "vector": [14, 2, 0.6938, 0.0024, 2, 0.12, 1.0, 195, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot_address = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L292_C2", "label": "robot_address = property()", "type": "assigned_variable", "loc": [292, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [14, 1, 0.6998, 0.0048, 1, 0.87, 0.6538, 559, 3, 3, 0, 0, 244, 10, 1], "semantic": {"name": "robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " robot_address = property(_get_robot_address, _set_robot_address,\n doc='Get or set the address of the current robot.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2", "label": "root_blip", "type": "function", "loc": [296, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.7105, 0.0072, 1, 0.87, 0.6923, 139, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "root_blip", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def root_blip(self):\n \"\"\"Returns this wavelet's root blip.\"\"\"\n return self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L297_C4", "label": "expression", "type": "expression", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2", "vector": [8, 2, 0.7105, 0.0024, 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 this wavelet's root blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L298_C4", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2", "vector": [13, 2, 0.7129, 0.0024, 2, 0.85, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2", "label": "blips", "type": "function", "loc": [301, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.7225, 0.0072, 1, 0.87, 0.7308, 391, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "blips", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blips(self):\n \"\"\"Returns the blips for this wavelet.\"\"\"\n return self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L302_C4", "label": "expression", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2", "vector": [8, 2, 0.7225, 0.0024, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns the blips for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L303_C4", "label": "return", "type": "return", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2", "vector": [13, 2, 0.7249, 0.0024, 2, 0.18, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2", "label": "get_operation_queue", "type": "function", "loc": [305, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.7321, 0.0072, 1, 0.87, 0.7692, 481, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_operation_queue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_operation_queue(self):\n \"\"\"Returns the OperationQueue for this wavelet.\"\"\"\n return self._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L306_C4", "label": "expression", "type": "expression", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2", "vector": [8, 2, 0.7321, 0.0024, 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 OperationQueue for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L307_C4", "label": "return", "type": "return", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2", "vector": [13, 2, 0.7344, 0.0024, 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._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2", "label": "serialize", "type": "function", "loc": [309, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.7536, 0.0311, 1, 0.87, 0.8077, 50, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a dict of the wavelet properties.\"\"\"\n return {'waveId': self._wave_id,\n 'waveletId': self._wavelet_id,\n 'creator': self._creator,\n 'creationTime': self._creation_time,\n 'dataDocuments': self._data_documents.serialize(),\n 'lastModifiedTime': self._last_modified_time,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L310_C4", "label": "expression", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2", "vector": [8, 2, 0.7416, 0.0024, 2, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a dict of the wavelet properties.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L311_C4", "label": "return", "type": "return", "loc": [311, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2", "vector": [13, 2, 0.756, 0.0263, 2, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 6, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'waveId': self._wave_id,\n 'waveletId': self._wavelet_id,\n 'creator': self._creator,\n 'creationTime': self._creation_time,\n 'dataDocuments': self._data_documents.serialize(),\n 'lastModifiedTime': self._last_modified_time,\n 'participants': self._participants.serialize(),\n 'title': self._title,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "label": "proxy_for", "type": "function", "loc": [323, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.8074, 0.0718, 1, 0.87, 0.8462, 365, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy_for_id):\n \"\"\"Return a view on this wavelet that will proxy for the specified id.\n\n A shallow copy of the current wavelet is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L324_C4", "label": "expression", "type": "expression", "loc": [324, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [8, 2, 0.7871, 0.0263, 2, 0.56, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a view on this wavelet that will proxy for the specified id.\n\n A shallow copy of the current wavelet is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n\n If the wavelet was retrieved using the Active Robot API, that is"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L335_C4", "label": "add_proxying_participant()", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [8, 2, 0.8014, 0.0024, 2, 0.56, 0.0667, 586, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_proxying_participant", "arg_names": [], "import_names": [], "rhs_call_name": "add_proxying_participant", "annotation": ""}, "snippet": " self.add_proxying_participant(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L336_C4", "label": "operation_queue = proxy_for()", "type": "assigned_variable", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8038, 0.0024, 2, 0.56, 0.1333, 919, 3, 1, 0, 0, 365, 10, 2], "semantic": {"name": "operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "proxy_for", "annotation": ""}, "snippet": " operation_queue = self.get_operation_queue().proxy_for(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L337_C4", "label": "res = Wavelet()", "type": "assigned_variable", "loc": [337, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8098, 0.0096, 2, 0.56, 0.2, 413, 3, 4, 0, 0, 108, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Wavelet", "annotation": ""}, "snippet": " res = Wavelet(json={},\n blips={},\n robot=self.robot,\n operation_queue=operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L341_C4", "label": "res._wave_id =", "type": "assigned_variable", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8158, 0.0024, 2, 0.56, 0.2667, 620, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wave_id = self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L342_C4", "label": "res._wavelet_id =", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8182, 0.0024, 2, 0.56, 0.3333, 917, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wavelet_id = self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L343_C4", "label": "res._creator =", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8206, 0.0024, 2, 0.56, 0.4, 937, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creator = self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L344_C4", "label": "res._creation_time =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.823, 0.0024, 2, 0.56, 0.4667, 642, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creation_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creation_time = self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L345_C4", "label": "res._data_documents =", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8254, 0.0024, 2, 0.56, 0.5333, 595, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._data_documents", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._data_documents = self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L346_C4", "label": "res._last_modified_time =", "type": "assigned_variable", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8278, 0.0024, 2, 0.56, 0.6, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._last_modified_time = self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L347_C4", "label": "res._participants =", "type": "assigned_variable", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8301, 0.0024, 2, 0.56, 0.6667, 901, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._participants = self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L348_C4", "label": "res._title =", "type": "assigned_variable", "loc": [348, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8325, 0.0024, 2, 0.56, 0.7333, 429, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._title = self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L349_C4", "label": "res._raw_data =", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8349, 0.0024, 2, 0.56, 0.8, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._raw_data = self._raw_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L350_C4", "label": "res._blips =", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8373, 0.0024, 2, 0.56, 0.8667, 426, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._blips = self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L351_C4", "label": "res._root_blip =", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [14, 2, 0.8397, 0.0024, 2, 0.56, 0.9333, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._root_blip = self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L352_C4", "label": "return", "type": "return", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "vector": [13, 2, 0.8421, 0.0024, 2, 0.56, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "label": "add_proxying_participant", "type": "function", "loc": [354, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.872, 0.0526, 1, 0.87, 0.8846, 586, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "add_proxying_participant", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_proxying_participant(self, id):\n \"\"\"Ads a proxying participant to the wave.\n\n Proxying participants are of the form robot+proxy@domain.com. This\n convenience method constructs this id and then calls participants.add.\n \"\"\"\n if not self.robot_address:\n raise errors.Error("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L355_C4", "label": "expression", "type": "expression", "loc": [355, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [8, 2, 0.8541, 0.012, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Ads a proxying participant to the wave.\n\n Proxying participants are of the form robot+proxy@domain.com. This\n convenience method constructs this id and then calls participants.add.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L360_C4", "label": "if", "type": "if", "loc": [360, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [4, 2, 0.8636, 0.0072, 2, 0.63, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.robot_address:\n raise errors.Error(\n 'Need a robot address to add a proxying for participant')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L363_C4", "label": "robotid, domain = split()", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [14, 2, 0.8684, 0.0024, 2, 0.63, 0.3333, 736, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "robotid, domain", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " robotid, domain = self.robot_address.split('@', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4", "label": "if", "type": "if", "loc": [364, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [4, 2, 0.8744, 0.0096, 2, 0.63, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '#' in robotid:\n robotid, version = robotid.split('#')\n else:\n version = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L365_C6", "label": "robotid, version = split()", "type": "assigned_variable", "loc": [365, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4", "vector": [14, 3, 0.8732, 0.0024, 3, 0.54, 0.0, 243, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "robotid, version", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " robotid, version = robotid.split('#')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L367_C6", "label": "version =", "type": "assigned_variable", "loc": [367, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4", "vector": [14, 3, 0.878, 0.0024, 3, 0.54, 1.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_1118:If_L368_C4", "label": "if", "type": "if", "loc": [368, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [4, 2, 0.884, 0.0096, 2, 0.63, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '+' in robotid:\n newid = robotid.split('+', 1)[0] + '+' + id\n else:\n newid = robotid + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L369_C6", "label": "newid =", "type": "assigned_variable", "loc": [369, 369], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L368_C4", "vector": [14, 3, 0.8828, 0.0024, 3, 0.02, 0.0, 189, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newid = robotid.split('+', 1)[0] + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L371_C6", "label": "newid =", "type": "assigned_variable", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L368_C4", "vector": [14, 3, 0.8876, 0.0024, 3, 0.02, 1.0, 189, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newid = robotid + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L372_C4", "label": "if", "type": "if", "loc": [372, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [4, 2, 0.8911, 0.0048, 2, 0.63, 0.8333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version:\n newid += '#' + version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L375_C4", "label": "add()", "type": "expression", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "vector": [8, 2, 0.8971, 0.0024, 2, 0.63, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.participants.add(newid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "label": "submit_with", "type": "function", "loc": [377, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.9127, 0.0239, 1, 0.87, 0.9231, 936, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "submit_with", "arg_names": ["self", "other_wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def submit_with(self, other_wavelet):\n \"\"\"Submit this wavelet when the passed other wavelet is submited.\n\n wavelets constructed outside of the event callback need to\n be either explicitly submited using robot.submit(wavelet) or be\n associated with a different wavelet that will be submited or\n is part of the event callback.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L378_C4", "label": "expression", "type": "expression", "loc": [378, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "vector": [8, 2, 0.9115, 0.0167, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Submit this wavelet when the passed other wavelet is submited.\n\n wavelets constructed outside of the event callback need to\n be either explicitly submited using robot.submit(wavelet) or be\n associated with a different wavelet that will be submited or\n is part of the event callback.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L385_C4", "label": "copy_operations()", "type": "expression", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "vector": [8, 2, 0.9211, 0.0024, 2, 0.98, 0.5, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "copy_operations", "arg_names": [], "import_names": [], "rhs_call_name": "copy_operations", "annotation": ""}, "snippet": " other_wavelet._operation_queue.copy_operations(self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L386_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "vector": [14, 2, 0.9234, 0.0024, 2, 0.98, 1.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = other_wavelet._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "label": "reply", "type": "function", "loc": [388, 405], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.9486, 0.0431, 1, 0.87, 0.9615, 714, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "reply", "arg_names": ["self", "initial_content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reply(self, initial_content=None):\n \"\"\"Replies to the conversation in this wavelet.\n\n Args:\n initial_content: If set, start with this (string) content.\n\n Returns:\n A transient version of the blip that contains the reply."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L389_C4", "label": "expression", "type": "expression", "loc": [389, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [8, 2, 0.939, 0.0191, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Replies to the conversation in this wavelet.\n\n Args:\n initial_content: If set, start with this (string) content.\n\n Returns:\n A transient version of the blip that contains the reply.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L397_C4", "label": "if", "type": "if", "loc": [397, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [4, 2, 0.951, 0.0048, 2, 0.05, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not initial_content:\n initial_content = u'\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L398_C6", "label": "initial_content =", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L397_C4", "vector": [14, 3, 0.9522, 0.0024, 3, 0.46, 0.0, 348, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "initial_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " initial_content = u'\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L399_C4", "label": "initial_content = force_unicode()", "type": "assigned_variable", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [14, 2, 0.9545, 0.0024, 2, 0.05, 0.3333, 348, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "initial_content", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " initial_content = util.force_unicode(initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L400_C4", "label": "blip_data = wavelet_append_blip()", "type": "assigned_variable", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [14, 2, 0.9581, 0.0048, 2, 0.05, 0.5, 892, 3, 3, 0, 0, 420, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_append_blip", "annotation": ""}, "snippet": " blip_data = self._operation_queue.wavelet_append_blip(\n self.wave_id, self.wavelet_id, initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L403_C4", "label": "instance = Blip()", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [14, 2, 0.9641, 0.0024, 2, 0.05, 0.6667, 255, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "instance", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " instance = blip.Blip(blip_data, self._blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L404_C4", "label": "_add()", "type": "expression", "loc": [404, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [8, 2, 0.9665, 0.0024, 2, 0.05, 0.8333, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._blips._add(instance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L405_C4", "label": "return", "type": "return", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "vector": [13, 2, 0.9689, 0.0024, 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 instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "label": "delete", "type": "function", "loc": [407, 418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "vector": [2, 1, 0.9868, 0.0287, 1, 0.87, 1.0, 266, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": ["self", "todelete"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, todelete):\n \"\"\"Remove a blip from this wavelet.\n\n Args:\n todelete: either a blip or a blip id to be removed.\n \"\"\"\n if isinstance(todelete, blip.Blip):\n blip_id = todelete.blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L408_C4", "label": "expression", "type": "expression", "loc": [408, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "vector": [8, 2, 0.9809, 0.012, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Remove a blip from this wavelet.\n\n Args:\n todelete: either a blip or a blip id to be removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4", "label": "if", "type": "if", "loc": [413, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "vector": [4, 2, 0.9916, 0.0096, 2, 0.46, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(todelete, blip.Blip):\n blip_id = todelete.blip_id\n else:\n blip_id = todelete"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L414_C6", "label": "blip_id =", "type": "assigned_variable", "loc": [414, 414], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4", "vector": [14, 3, 0.9904, 0.0024, 3, 0.21, 0.0, 161, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_id = todelete.blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L416_C6", "label": "blip_id =", "type": "assigned_variable", "loc": [416, 416], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4", "vector": [14, 3, 0.9952, 0.0024, 3, 0.21, 1.0, 161, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_id = todelete"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L417_C4", "label": "blip_delete()", "type": "expression", "loc": [417, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "vector": [8, 2, 0.9976, 0.0024, 2, 0.46, 0.6667, 397, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "blip_delete", "arg_names": [], "import_names": [], "rhs_call_name": "blip_delete", "annotation": ""}, "snippet": " self._operation_queue.blip_delete(self.wave_id, self.wavelet_id, blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L418_C4", "label": "_remove_with_id()", "type": "expression", "loc": [418, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "vector": [8, 2, 1.0, 0.0024, 2, 0.46, 1.0, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": [], "import_names": [], "rhs_call_name": "_remove_with_id", "annotation": ""}, "snippet": " self._blips._remove_with_id(blip_id)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L41_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L55_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L117_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L124_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L137_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L146_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L199_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L201_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L215_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L225_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L234_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L236_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L239_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L249_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L254_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L258_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L258_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L274_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L275_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L276_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L278_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L281_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L284_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L284_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L287_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L292_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L296_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L301_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L305_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L309_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L365_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L367_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L369_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L371_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L385_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L386_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L397_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L397_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L398_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L399_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L400_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Return_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L414_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Assign_L416_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L417_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1118:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1118:Expr_L418_C4"}] |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Tests for google3.walkabout.externalagents.api.commandline_robot_runner."""
__author__ = 'douwe@google.com (Douwe Osinga)'
import StringIO
from google3.pyglib import app
from google3.pyglib import flags
from google3.testing.pybase import googletest
from google3.walkabout.externalagents.api import commandline_robot_runner
from google3.walkabout.externalagents.api import events
FLAGS = flags.FLAGS
BLIP_JSON = ('{"wdykLROk*13":'
'{"lastModifiedTime":1242079608457,'
'"contributors":["someguy@test.com"],'
'"waveletId":"test.com!conv+root",'
'"waveId":"test.com!wdykLROk*11",'
'"parentBlipId":null,'
'"version":3,'
'"creator":"someguy@test.com",'
'"content":"\\nContent!",'
'"blipId":"wdykLROk*13",'
'"annotations":[{"range":{"start":0,"end":1},'
'"name":"user/e/otherguy@test.com","value":"Other"}],'
'"elements":{},'
'"childBlipIds":[]}'
'}')
WAVELET_JSON = ('{"lastModifiedTime":1242079611003,'
'"title":"A title",'
'"waveletId":"test.com!conv+root",'
'"rootBlipId":"wdykLROk*13",'
'"dataDocuments":null,'
'"creationTime":1242079608457,'
'"waveId":"test.com!wdykLROk*11",'
'"participants":["someguy@test.com","monty@appspot.com"],'
'"creator":"someguy@test.com",'
'"version":5}')
EVENTS_JSON = ('[{"timestamp":1242079611003,'
'"modifiedBy":"someguy@test.com",'
'"properties":{"participantsRemoved":[],'
'"participantsAdded":["monty@appspot.com"]},'
'"type":"WAVELET_PARTICIPANTS_CHANGED"}]')
TEST_JSON = '{"blips":%s,"wavelet":%s,"events":%s}' % (
BLIP_JSON, WAVELET_JSON, EVENTS_JSON)
class CommandlineRobotRunnerTest(googletest.TestCase):
def testSimpleFlow(self):
FLAGS.eventdef_wavelet_participants_changed = 'x'
flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()
setattr(FLAGS, flag, 'w.title="New title!"')
input_stream = StringIO.StringIO(TEST_JSON)
output_stream = StringIO.StringIO()
commandline_robot_runner.run_bot(input_stream, output_stream)
res = output_stream.getvalue()
self.assertTrue('wavelet.setTitle' in res)
def main(unused_argv):
googletest.main()
if __name__ == '__main__':
app.run()
| ajibawa-2023/Python-Code-Large/train/row_1119 | 27 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0658, 0.0132, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Tests for google3.walkabout.externalagents.api.commandline_robot_runner.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L7_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0921, 0.0132, 0, 0.66, 0.0667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'douwe@google.com (Douwe Osinga)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Import_L9_C0", "label": "StringIO import StringIO", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1184, 0.0132, 0, 0.66, 0.1333, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ImportFrom_L11_C0", "label": "from google3.pyglib import app", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1447, 0.0132, 0, 0.66, 0.2, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ImportFrom_L12_C0", "label": "from google3.pyglib import flags", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0132, 0, 0.66, 0.2667, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["flags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ImportFrom_L14_C0", "label": "from google3.testing.pybase import googletest", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1842, 0.0132, 0, 0.66, 0.3333, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "google3.testing.pybase", "arg_names": [], "import_names": ["googletest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.testing.pybase import googletest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ImportFrom_L15_C0", "label": "from google3.walkabout.externalagents.api import commandline_robot_runner", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1974, 0.0132, 0, 0.66, 0.4, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["commandline_robot_runner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import commandline_robot_runner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ImportFrom_L16_C0", "label": "from google3.walkabout.externalagents.api import events", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0132, 0, 0.66, 0.4667, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L18_C0", "label": "FLAGS =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.2368, 0.0132, 0, 0.66, 0.5333, 578, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLAGS = flags.FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L21_C0", "label": "BLIP_JSON =", "type": "assigned_variable", "loc": [21, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3684, 0.1974, 0, 0.66, 0.6, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_JSON = ('{\"wdykLROk*13\":'\n '{\"lastModifiedTime\":1242079608457,'\n '\"contributors\":[\"someguy@test.com\"],'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"parentBlipId\":null,'\n '\"version\":3,'\n '\"creator\":\"someguy@test.com\",'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L37_C0", "label": "WAVELET_JSON =", "type": "assigned_variable", "loc": [37, 46], "level": 0, "parent": null, "vector": [14, 0, 0.5461, 0.1316, 0, 0.66, 0.6667, 26, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_JSON = ('{\"lastModifiedTime\":1242079611003,'\n '\"title\":\"A title\",'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"rootBlipId\":\"wdykLROk*13\",'\n '\"dataDocuments\":null,'\n '\"creationTime\":1242079608457,'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"participants\":[\"someguy@test.com\",\"monty@appspot.com\"],'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L48_C0", "label": "EVENTS_JSON =", "type": "assigned_variable", "loc": [48, 52], "level": 0, "parent": null, "vector": [14, 0, 0.6579, 0.0658, 0, 0.66, 0.7333, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "EVENTS_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EVENTS_JSON = ('[{\"timestamp\":1242079611003,'\n '\"modifiedBy\":\"someguy@test.com\",'\n '\"properties\":{\"participantsRemoved\":[],'\n '\"participantsAdded\":[\"monty@appspot.com\"]},'\n '\"type\":\"WAVELET_PARTICIPANTS_CHANGED\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L54_C0", "label": "TEST_JSON =", "type": "assigned_variable", "loc": [54, 55], "level": 0, "parent": null, "vector": [14, 0, 0.7171, 0.0263, 0, 0.66, 0.8, 23, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEST_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_JSON = '{\"blips\":%s,\"wavelet\":%s,\"events\":%s}' % (\n BLIP_JSON, WAVELET_JSON, EVENTS_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:ClassDef_L58_C0", "label": "CommandlineRobotRunnerTest", "type": "class", "loc": [58, 68], "level": 0, "parent": null, "vector": [3, 0, 0.8289, 0.1447, 0, 0.66, 0.8667, 632, 0, 1, 0, 0, 445, 0, 7], "semantic": {"name": "CommandlineRobotRunnerTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommandlineRobotRunnerTest(googletest.TestCase):\n\n def testSimpleFlow(self):\n FLAGS.eventdef_wavelet_participants_changed = 'x'\n flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()\n setattr(FLAGS, flag, 'w.title=\"New title!\"')\n input_stream = StringIO.StringIO(TEST_JSON)\n output_stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "label": "testSimpleFlow", "type": "function", "loc": [60, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:ClassDef_L58_C0", "vector": [2, 1, 0.8421, 0.1184, 1, 0.36, 0.0, 976, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testSimpleFlow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSimpleFlow(self):\n FLAGS.eventdef_wavelet_participants_changed = 'x'\n flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()\n setattr(FLAGS, flag, 'w.title=\"New title!\"')\n input_stream = StringIO.StringIO(TEST_JSON)\n output_stream = StringIO.StringIO()\n commandline_robot_runner.run_bot(input_stream, output_stream)\n res = output_stream.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L61_C4", "label": "FLAGS.eventdef_wavelet_participants_changed =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [14, 2, 0.8026, 0.0132, 2, 0.5, 0.0, 249, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FLAGS.eventdef_wavelet_participants_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FLAGS.eventdef_wavelet_participants_changed = 'x'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L62_C4", "label": "flag =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [14, 2, 0.8158, 0.0132, 2, 0.5, 0.1429, 756, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L63_C4", "label": "setattr()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [8, 2, 0.8289, 0.0132, 2, 0.5, 0.2857, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(FLAGS, flag, 'w.title=\"New title!\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L64_C4", "label": "input_stream = StringIO()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [14, 2, 0.8421, 0.0132, 2, 0.5, 0.4286, 122, 3, 1, 0, 0, 609, 10, 1], "semantic": {"name": "input_stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " input_stream = StringIO.StringIO(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L65_C4", "label": "output_stream = StringIO()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [14, 2, 0.8553, 0.0132, 2, 0.5, 0.5714, 354, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "output_stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " output_stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L66_C4", "label": "run_bot()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [8, 2, 0.8684, 0.0132, 2, 0.5, 0.7143, 707, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run_bot", "arg_names": [], "import_names": [], "rhs_call_name": "run_bot", "annotation": ""}, "snippet": " commandline_robot_runner.run_bot(input_stream, output_stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L67_C4", "label": "res = getvalue()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [14, 2, 0.8816, 0.0132, 2, 0.5, 0.8571, 413, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " res = output_stream.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L68_C4", "label": "assertTrue()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "vector": [8, 2, 0.8947, 0.0132, 2, 0.5, 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('wavelet.setTitle' in res)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L71_C0", "label": "main", "type": "function", "loc": [71, 72], "level": 0, "parent": null, "vector": [2, 0, 0.9408, 0.0263, 0, 0.66, 0.9333, 624, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": ["unused_argv"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main(unused_argv):\n googletest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L71_C0", "vector": [8, 1, 0.9474, 0.0132, 1, 0.06, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " googletest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:If_L75_C0", "label": "if", "type": "if", "loc": [75, 76], "level": 0, "parent": null, "vector": [4, 0, 0.9934, 0.0263, 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 app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L76_C2", "label": "run()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1119:If_L75_C0", "vector": [8, 1, 1.0, 0.0132, 1, 0.71, 0.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " app.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1119:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1119:If_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1119:Expr_L76_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Script to run all unit tests in this package."""
import blip_test
import element_test
import module_test_runner
import ops_test
import robot_test
import util_test
import wavelet_test
def RunUnitTests():
"""Runs all registered unit tests."""
test_runner = module_test_runner.ModuleTestRunner()
test_runner.modules = [
blip_test,
element_test,
ops_test,
robot_test,
util_test,
wavelet_test,
]
test_runner.RunAllTests()
if __name__ == "__main__":
RunUnitTests()
| ajibawa-2023/Python-Code-Large/train/row_1120 | 15 | 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_1120:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.3864, 0.0227, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Script to run all unit tests in this package.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L20_C0", "label": "blip_test import blip_test", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.4545, 0.0227, 0, 0.66, 0.1111, 740, 0, 1, 0, 0, 740, 0, 0], "semantic": {"name": "blip_test", "arg_names": [], "import_names": ["blip_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L21_C0", "label": "element_test import element_test", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.4773, 0.0227, 0, 0.66, 0.2222, 514, 0, 1, 0, 0, 514, 0, 0], "semantic": {"name": "element_test", "arg_names": [], "import_names": ["element_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L22_C0", "label": "module_test_runner import module_test_runner", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0227, 0, 0.66, 0.3333, 497, 0, 1, 0, 0, 497, 0, 0], "semantic": {"name": "module_test_runner", "arg_names": [], "import_names": ["module_test_runner"], "rhs_call_name": "", "annotation": ""}, "snippet": "import module_test_runner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L23_C0", "label": "ops_test import ops_test", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.5227, 0.0227, 0, 0.66, 0.4444, 123, 0, 1, 0, 0, 123, 0, 0], "semantic": {"name": "ops_test", "arg_names": [], "import_names": ["ops_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L24_C0", "label": "robot_test import robot_test", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0227, 0, 0.66, 0.5556, 406, 0, 1, 0, 0, 406, 0, 0], "semantic": {"name": "robot_test", "arg_names": [], "import_names": ["robot_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robot_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L25_C0", "label": "util_test import util_test", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.5682, 0.0227, 0, 0.66, 0.6667, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "util_test", "arg_names": [], "import_names": ["util_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Import_L26_C0", "label": "wavelet_test import wavelet_test", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.5909, 0.0227, 0, 0.66, 0.7778, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "wavelet_test", "arg_names": [], "import_names": ["wavelet_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wavelet_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "label": "RunUnitTests", "type": "function", "loc": [29, 40], "level": 0, "parent": null, "vector": [2, 0, 0.7841, 0.2727, 0, 0.66, 0.8889, 450, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "RunUnitTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RunUnitTests():\n \"\"\"Runs all registered unit tests.\"\"\"\n test_runner = module_test_runner.ModuleTestRunner()\n test_runner.modules = [\n blip_test,\n element_test,\n ops_test,\n robot_test,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L30_C2", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "vector": [8, 1, 0.6818, 0.0227, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Runs all registered unit tests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Assign_L31_C2", "label": "test_runner = ModuleTestRunner()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "vector": [14, 1, 0.7045, 0.0227, 1, 0.06, 0.3333, 530, 3, 0, 0, 0, 109, 10, 1], "semantic": {"name": "test_runner", "arg_names": [], "import_names": [], "rhs_call_name": "ModuleTestRunner", "annotation": ""}, "snippet": " test_runner = module_test_runner.ModuleTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Assign_L32_C2", "label": "test_runner.modules =", "type": "assigned_variable", "loc": [32, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "vector": [14, 1, 0.8068, 0.1818, 1, 0.06, 0.6667, 523, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "test_runner.modules", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " test_runner.modules = [\n blip_test,\n element_test,\n ops_test,\n robot_test,\n util_test,\n wavelet_test,\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L40_C2", "label": "RunAllTests()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "vector": [8, 1, 0.9091, 0.0227, 1, 0.06, 1.0, 52, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "RunAllTests", "arg_names": [], "import_names": [], "rhs_call_name": "RunAllTests", "annotation": ""}, "snippet": " test_runner.RunAllTests()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:If_L43_C0", "label": "if", "type": "if", "loc": [43, 44], "level": 0, "parent": null, "vector": [4, 0, 0.9886, 0.0455, 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 RunUnitTests()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L44_C2", "label": "RunUnitTests()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1120:If_L43_C0", "vector": [8, 1, 1.0, 0.0227, 1, 0.78, 0.0, 450, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "RunUnitTests", "arg_names": [], "import_names": [], "rhs_call_name": "RunUnitTests", "annotation": ""}, "snippet": " RunUnitTests()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1120:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1120:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1120:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1120:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1120:Expr_L44_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the util module."""
__author__ = 'davidbyttow@google.com (David Byttow)'
import unittest
import ops
import util
class TestUtils(unittest.TestCase):
"""Tests utility functions."""
def testIsIterable(self):
self.assertTrue(util.is_iterable([]))
self.assertTrue(util.is_iterable({}))
self.assertTrue(util.is_iterable(set()))
self.assertTrue(util.is_iterable(()))
self.assertFalse(util.is_iterable(42))
self.assertFalse(util.is_iterable('list?'))
self.assertFalse(util.is_iterable(object))
def testIsDict(self):
self.assertFalse(util.is_dict([]))
self.assertTrue(util.is_dict({}))
self.assertFalse(util.is_dict(set()))
self.assertFalse(util.is_dict(()))
self.assertFalse(util.is_dict(42))
self.assertFalse(util.is_dict('dict?'))
self.assertFalse(util.is_dict(object))
def testIsUserDefinedNewStyleClass(self):
class OldClass:
pass
class NewClass(object):
pass
self.assertFalse(util.is_user_defined_new_style_class(OldClass()))
self.assertTrue(util.is_user_defined_new_style_class(NewClass()))
self.assertFalse(util.is_user_defined_new_style_class({}))
self.assertFalse(util.is_user_defined_new_style_class(()))
self.assertFalse(util.is_user_defined_new_style_class(42))
self.assertFalse(util.is_user_defined_new_style_class('instance?'))
def testLowerCamelCase(self):
self.assertEquals('foo', util.lower_camel_case('foo'))
self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))
self.assertEquals('fooBar', util.lower_camel_case('fooBar'))
self.assertEquals('blipId', util.lower_camel_case('blip_id'))
self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))
self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))
self.assertEquals('f', util.lower_camel_case('f'))
self.assertEquals('f', util.lower_camel_case('f_'))
self.assertEquals('', util.lower_camel_case(''))
self.assertEquals('', util.lower_camel_case('_'))
self.assertEquals('aBCDEF', util.lower_camel_case('_a_b_c_d_e_f_'))
def assertListsEqual(self, a, b):
self.assertEquals(len(a), len(b))
for i in range(len(a)):
self.assertEquals(a[i], b[i])
def assertDictsEqual(self, a, b):
self.assertEquals(len(a.keys()), len(b.keys()))
for k, v in a.iteritems():
self.assertEquals(v, b[k])
def testSerializeList(self):
data = [1, 2, 3]
output = util.serialize(data)
self.assertListsEqual(data, output)
def testSerializeDict(self):
data = {'key': 'value', 'under_score': 'value2'}
expected = {'key': 'value', 'underScore': 'value2'}
output = util.serialize(data)
self.assertDictsEqual(expected, output)
def testNonNoneDict(self):
a = {'a': 1, 'b': 1}
self.assertDictsEqual(a, util.non_none_dict(a))
b = a.copy()
b['c'] = None
self.assertDictsEqual(a, util.non_none_dict(b))
def testForceUnicode(self):
self.assertEquals(u"aaa", util.force_unicode("aaa"))
self.assertEquals(u"12", util.force_unicode(12))
self.assertEquals(u"\u0430\u0431\u0432",
util.force_unicode("\xd0\xb0\xd0\xb1\xd0\xb2"))
self.assertEquals(u'\u30e6\u30cb\u30b3\u30fc\u30c9',
util.force_unicode(u'\u30e6\u30cb\u30b3\u30fc\u30c9'))
def testSerializeAttributes(self):
class Data(object):
def __init__(self):
self.public = 1
self._protected = 2
self.__private = 3
def Func(self):
pass
data = Data()
output = util.serialize(data)
# Functions and non-public fields should not be serialized.
self.assertEquals(1, len(output.keys()))
self.assertEquals(data.public, output['public'])
def testStringEnum(self):
util.StringEnum()
single = util.StringEnum('foo')
self.assertEquals('foo', single.foo)
multi = util.StringEnum('foo', 'bar')
self.assertEquals('foo', multi.foo)
self.assertEquals('bar', multi.bar)
def testParseMarkup(self):
self.assertEquals('foo', util.parse_markup('foo'))
self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))
self.assertEquals('foo\nbar', util.parse_markup('foo<br>bar'))
self.assertEquals('foo\nbar', util.parse_markup('foo<p indent="3">bar'))
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1121 | 97 | 145 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1172, 0.0069, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the util module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L20_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.1379, 0.0069, 0, 0.66, 0.1667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'davidbyttow@google.com (David Byttow)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Import_L23_C0", "label": "unittest import unittest", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1586, 0.0069, 0, 0.66, 0.3333, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Import_L25_C0", "label": "ops import ops", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1724, 0.0069, 0, 0.66, 0.5, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Import_L26_C0", "label": "util import util", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1793, 0.0069, 0, 0.66, 0.6667, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "label": "TestUtils", "type": "class", "loc": [29, 142], "level": 0, "parent": null, "vector": [3, 0, 0.5897, 0.7862, 0, 0.66, 0.8333, 402, 0, 15, 0, 0, 878, 0, 99], "semantic": {"name": "TestUtils", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestUtils(unittest.TestCase):\n \"\"\"Tests utility functions.\"\"\"\n\n def testIsIterable(self):\n self.assertTrue(util.is_iterable([]))\n self.assertTrue(util.is_iterable({}))\n self.assertTrue(util.is_iterable(set()))\n self.assertTrue(util.is_iterable(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L30_C2", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [8, 1, 0.2069, 0.0069, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests utility functions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "label": "testIsIterable", "type": "function", "loc": [32, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.2448, 0.0552, 1, 0.97, 0.0769, 468, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "testIsIterable", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsIterable(self):\n self.assertTrue(util.is_iterable([]))\n self.assertTrue(util.is_iterable({}))\n self.assertTrue(util.is_iterable(set()))\n self.assertTrue(util.is_iterable(()))\n self.assertFalse(util.is_iterable(42))\n self.assertFalse(util.is_iterable('list?'))\n self.assertFalse(util.is_iterable(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L33_C4", "label": "assertTrue()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2276, 0.0069, 2, 0.77, 0.0, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable([]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L34_C4", "label": "assertTrue()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2345, 0.0069, 2, 0.77, 0.1667, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L35_C4", "label": "assertTrue()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2414, 0.0069, 2, 0.77, 0.3333, 170, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable(set()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L36_C4", "label": "assertTrue()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2483, 0.0069, 2, 0.77, 0.5, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_iterable(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L37_C4", "label": "assertFalse()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2552, 0.0069, 2, 0.77, 0.6667, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_iterable(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L38_C4", "label": "assertFalse()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.2621, 0.0069, 2, 0.77, 0.8333, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_iterable('list?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L39_C4", "label": "assertFalse()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "vector": [8, 2, 0.269, 0.0069, 2, 0.77, 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(util.is_iterable(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "label": "testIsDict", "type": "function", "loc": [41, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.3069, 0.0552, 1, 0.97, 0.1538, 340, 0, 1, 0, 0, 0, 0, 15], "semantic": {"name": "testIsDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsDict(self):\n self.assertFalse(util.is_dict([]))\n self.assertTrue(util.is_dict({}))\n self.assertFalse(util.is_dict(set()))\n self.assertFalse(util.is_dict(()))\n self.assertFalse(util.is_dict(42))\n self.assertFalse(util.is_dict('dict?'))\n self.assertFalse(util.is_dict(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L42_C4", "label": "assertFalse()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.2897, 0.0069, 2, 0.09, 0.0, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict([]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L43_C4", "label": "assertTrue()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.2966, 0.0069, 2, 0.09, 0.1667, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_dict({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L44_C4", "label": "assertFalse()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.3034, 0.0069, 2, 0.09, 0.3333, 861, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict(set()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L45_C4", "label": "assertFalse()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.3103, 0.0069, 2, 0.09, 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(util.is_dict(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L46_C4", "label": "assertFalse()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.3172, 0.0069, 2, 0.09, 0.6667, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L47_C4", "label": "assertFalse()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.3241, 0.0069, 2, 0.09, 0.8333, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_dict('dict?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L48_C4", "label": "assertFalse()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "vector": [8, 2, 0.331, 0.0069, 2, 0.09, 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(util.is_dict(object))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "label": "testIsUserDefinedNewStyleClass", "type": "function", "loc": [50, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.3862, 0.0897, 1, 0.97, 0.2308, 363, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "testIsUserDefinedNewStyleClass", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIsUserDefinedNewStyleClass(self):\n class OldClass:\n pass\n\n class NewClass(object):\n pass\n\n self.assertFalse(util.is_user_defined_new_style_class(OldClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L51_C4", "label": "OldClass", "type": "class", "loc": [51, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [3, 2, 0.3552, 0.0138, 2, 0.52, 0.0, 688, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "OldClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class OldClass:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L54_C4", "label": "NewClass", "type": "class", "loc": [54, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [3, 2, 0.3759, 0.0138, 2, 0.52, 0.1429, 65, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "NewClass", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class NewClass(object):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L57_C4", "label": "assertFalse()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.3931, 0.0069, 2, 0.52, 0.2857, 861, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_user_defined_new_style_class(OldClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L58_C4", "label": "assertTrue()", "type": "expression", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.4, 0.0069, 2, 0.52, 0.4286, 170, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(util.is_user_defined_new_style_class(NewClass()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L59_C4", "label": "assertFalse()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.4069, 0.0069, 2, 0.52, 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(util.is_user_defined_new_style_class({}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L60_C4", "label": "assertFalse()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.4138, 0.0069, 2, 0.52, 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(util.is_user_defined_new_style_class(()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L61_C4", "label": "assertFalse()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.4207, 0.0069, 2, 0.52, 0.8571, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(util.is_user_defined_new_style_class(42))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L62_C4", "label": "assertFalse()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "vector": [8, 2, 0.4276, 0.0069, 2, 0.52, 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(util.is_user_defined_new_style_class('instance?'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "label": "testLowerCamelCase", "type": "function", "loc": [64, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.4793, 0.0828, 1, 0.97, 0.3077, 436, 0, 1, 0, 0, 0, 0, 22], "semantic": {"name": "testLowerCamelCase", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testLowerCamelCase(self):\n self.assertEquals('foo', util.lower_camel_case('foo'))\n self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))\n self.assertEquals('fooBar', util.lower_camel_case('fooBar'))\n self.assertEquals('blipId', util.lower_camel_case('blip_id'))\n self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))\n self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))\n self.assertEquals('f', util.lower_camel_case('f'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L65_C4", "label": "assertEquals()", "type": "expression", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4483, 0.0069, 2, 0.6, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', util.lower_camel_case('foo'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L66_C4", "label": "assertEquals()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4552, 0.0069, 2, 0.6, 0.1, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('foo_bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L67_C4", "label": "assertEquals()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4621, 0.0069, 2, 0.6, 0.2, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('fooBar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L68_C4", "label": "assertEquals()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.469, 0.0069, 2, 0.6, 0.3, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('blipId', util.lower_camel_case('blip_id'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L69_C4", "label": "assertEquals()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4759, 0.0069, 2, 0.6, 0.4, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBar', util.lower_camel_case('foo__bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L70_C4", "label": "assertEquals()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4828, 0.0069, 2, 0.6, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('fooBarBaz', util.lower_camel_case('foo_bar_baz'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4897, 0.0069, 2, 0.6, 0.6, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('f', util.lower_camel_case('f'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.4966, 0.0069, 2, 0.6, 0.7, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('f', util.lower_camel_case('f_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.5034, 0.0069, 2, 0.6, 0.8, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('', util.lower_camel_case(''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.5103, 0.0069, 2, 0.6, 0.9, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('', util.lower_camel_case('_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L75_C4", "label": "assertEquals()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "vector": [8, 2, 0.5172, 0.0069, 2, 0.6, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('aBCDEF', util.lower_camel_case('_a_b_c_d_e_f_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2", "label": "assertListsEqual", "type": "function", "loc": [77, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.5414, 0.0276, 1, 0.97, 0.3846, 938, 0, 3, 0, 0, 0, 0, 6], "semantic": {"name": "assertListsEqual", "arg_names": ["self", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertListsEqual(self, a, b):\n self.assertEquals(len(a), len(b))\n for i in range(len(a)):\n self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2", "vector": [8, 2, 0.5379, 0.0069, 2, 0.86, 0.0, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(a), len(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L79_C4", "label": "for i", "type": "for", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2", "vector": [6, 2, 0.5483, 0.0138, 2, 0.86, 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 range(len(a)):\n self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L80_C6", "label": "assertEquals()", "type": "expression", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L79_C4", "vector": [8, 3, 0.5517, 0.0069, 3, 0.15, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(a[i], b[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2", "label": "assertDictsEqual", "type": "function", "loc": [82, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.5759, 0.0276, 1, 0.97, 0.4615, 348, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "assertDictsEqual", "arg_names": ["self", "a", "b"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertDictsEqual(self, a, b):\n self.assertEquals(len(a.keys()), len(b.keys()))\n for k, v in a.iteritems():\n self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2", "vector": [8, 2, 0.5724, 0.0069, 2, 0.68, 0.0, 60, 3, 2, 0, 0, 0, 0, 5], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(a.keys()), len(b.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L84_C4", "label": "for k, v", "type": "for", "loc": [84, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2", "vector": [6, 2, 0.5828, 0.0138, 2, 0.68, 1.0, 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 a.iteritems():\n self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L85_C6", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L84_C4", "vector": [8, 3, 0.5862, 0.0069, 3, 0.6, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(v, b[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "label": "testSerializeList", "type": "function", "loc": [87, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.6103, 0.0276, 1, 0.97, 0.5385, 468, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testSerializeList", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeList(self):\n data = [1, 2, 3]\n output = util.serialize(data)\n self.assertListsEqual(data, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L88_C4", "label": "data =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "vector": [14, 2, 0.6069, 0.0069, 2, 0.9, 0.0, 929, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = [1, 2, 3]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L89_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "vector": [14, 2, 0.6138, 0.0069, 2, 0.9, 0.5, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L90_C4", "label": "assertListsEqual()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "vector": [8, 2, 0.6207, 0.0069, 2, 0.9, 1.0, 938, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertListsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertListsEqual", "annotation": ""}, "snippet": " self.assertListsEqual(data, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "label": "testSerializeDict", "type": "function", "loc": [92, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.6483, 0.0345, 1, 0.97, 0.6154, 33, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testSerializeDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeDict(self):\n data = {'key': 'value', 'under_score': 'value2'}\n expected = {'key': 'value', 'underScore': 'value2'}\n output = util.serialize(data)\n self.assertDictsEqual(expected, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L93_C4", "label": "data =", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "vector": [14, 2, 0.6414, 0.0069, 2, 0.55, 0.0, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {'key': 'value', 'under_score': 'value2'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L94_C4", "label": "expected =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "vector": [14, 2, 0.6483, 0.0069, 2, 0.55, 0.3333, 361, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "expected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expected = {'key': 'value', 'underScore': 'value2'}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L95_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "vector": [14, 2, 0.6552, 0.0069, 2, 0.55, 0.6667, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L96_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "vector": [8, 2, 0.6621, 0.0069, 2, 0.55, 1.0, 348, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(expected, output)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "label": "testNonNoneDict", "type": "function", "loc": [98, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.6931, 0.0414, 1, 0.97, 0.6923, 881, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testNonNoneDict", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testNonNoneDict(self):\n a = {'a': 1, 'b': 1}\n self.assertDictsEqual(a, util.non_none_dict(a))\n b = a.copy()\n b['c'] = None\n self.assertDictsEqual(a, util.non_none_dict(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L99_C4", "label": "a =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "vector": [14, 2, 0.6828, 0.0069, 2, 0.52, 0.0, 475, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " a = {'a': 1, 'b': 1}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L100_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "vector": [8, 2, 0.6897, 0.0069, 2, 0.52, 0.25, 348, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(a, util.non_none_dict(a))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L101_C4", "label": "b = copy()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "vector": [14, 2, 0.6966, 0.0069, 2, 0.52, 0.5, 756, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " b = a.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L102_C4", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "vector": [14, 2, 0.7034, 0.0069, 2, 0.52, 0.75, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b['c'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L103_C4", "label": "assertDictsEqual()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "vector": [8, 2, 0.7103, 0.0069, 2, 0.52, 1.0, 348, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertDictsEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertDictsEqual", "annotation": ""}, "snippet": " self.assertDictsEqual(a, util.non_none_dict(b))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "label": "testForceUnicode", "type": "function", "loc": [105, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.7448, 0.0483, 1, 0.97, 0.7692, 4, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testForceUnicode", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testForceUnicode(self):\n self.assertEquals(u\"aaa\", util.force_unicode(\"aaa\"))\n self.assertEquals(u\"12\", util.force_unicode(12))\n self.assertEquals(u\"\\u0430\\u0431\\u0432\",\n util.force_unicode(\"\\xd0\\xb0\\xd0\\xb1\\xd0\\xb2\"))\n self.assertEquals(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9',\n util.force_unicode(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "vector": [8, 2, 0.731, 0.0069, 2, 0.79, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"aaa\", util.force_unicode(\"aaa\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "vector": [8, 2, 0.7379, 0.0069, 2, 0.79, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"12\", util.force_unicode(12))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "vector": [8, 2, 0.7483, 0.0138, 2, 0.79, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u\"\\u0430\\u0431\\u0432\",\n util.force_unicode(\"\\xd0\\xb0\\xd0\\xb1\\xd0\\xb2\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L110_C4", "label": "assertEquals()", "type": "expression", "loc": [110, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "vector": [8, 2, 0.7621, 0.0138, 2, 0.79, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9',\n util.force_unicode(u'\\u30e6\\u30cb\\u30b3\\u30fc\\u30c9'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "label": "testSerializeAttributes", "type": "function", "loc": [113, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.831, 0.1103, 1, 0.97, 0.8462, 747, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testSerializeAttributes", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeAttributes(self):\n\n class Data(object):\n def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4", "label": "Data", "type": "class", "loc": [115, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "vector": [3, 2, 0.8172, 0.0552, 2, 0.74, 0.0, 467, 0, 2, 0, 0, 186, 0, 0], "semantic": {"name": "Data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class Data(object):\n def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3\n\n def Func(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "label": "__init__", "type": "function", "loc": [116, 119], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4", "vector": [2, 3, 0.8103, 0.0276, 3, 0.37, 0.0, 555, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n self.public = 1\n self._protected = 2\n self.__private = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L117_C8", "label": "self.public =", "type": "assigned_variable", "loc": [117, 117], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "vector": [14, 4, 0.8069, 0.0069, 4, 0.69, 0.0, 818, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.public", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.public = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L118_C8", "label": "self._protected =", "type": "assigned_variable", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "vector": [14, 4, 0.8138, 0.0069, 4, 0.69, 0.5, 613, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._protected", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._protected = 2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L119_C8", "label": "self.__private =", "type": "assigned_variable", "loc": [119, 119], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "vector": [14, 4, 0.8207, 0.0069, 4, 0.69, 1.0, 90, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self.__private", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__private = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L121_C6", "label": "Func", "type": "function", "loc": [121, 122], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4", "vector": [2, 3, 0.8379, 0.0138, 3, 0.37, 1.0, 208, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "Func", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Func(self):\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L124_C4", "label": "data = Data()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "vector": [14, 2, 0.8552, 0.0069, 2, 0.74, 0.25, 929, 3, 0, 0, 0, 467, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "Data", "annotation": ""}, "snippet": " data = Data()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L125_C4", "label": "output = serialize()", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "vector": [14, 2, 0.8621, 0.0069, 2, 0.74, 0.5, 886, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " output = util.serialize(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L127_C4", "label": "assertEquals()", "type": "expression", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "vector": [8, 2, 0.8759, 0.0069, 2, 0.74, 0.75, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(output.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L128_C4", "label": "assertEquals()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "vector": [8, 2, 0.8828, 0.0069, 2, 0.74, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(data.public, output['public'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "label": "testStringEnum", "type": "function", "loc": [130, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.9172, 0.0483, 1, 0.97, 0.9231, 952, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testStringEnum", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testStringEnum(self):\n util.StringEnum()\n single = util.StringEnum('foo')\n self.assertEquals('foo', single.foo)\n multi = util.StringEnum('foo', 'bar')\n self.assertEquals('foo', multi.foo)\n self.assertEquals('bar', multi.bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L131_C4", "label": "StringEnum()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [8, 2, 0.9034, 0.0069, 2, 0.76, 0.0, 716, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "StringEnum", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " util.StringEnum()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L132_C4", "label": "single = StringEnum()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [14, 2, 0.9103, 0.0069, 2, 0.76, 0.2, 311, 3, 1, 0, 0, 716, 10, 1], "semantic": {"name": "single", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " single = util.StringEnum('foo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L133_C4", "label": "assertEquals()", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [8, 2, 0.9172, 0.0069, 2, 0.76, 0.4, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', single.foo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L134_C4", "label": "multi = StringEnum()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [14, 2, 0.9241, 0.0069, 2, 0.76, 0.6, 988, 3, 2, 0, 0, 716, 10, 1], "semantic": {"name": "multi", "arg_names": [], "import_names": [], "rhs_call_name": "StringEnum", "annotation": ""}, "snippet": " multi = util.StringEnum('foo', 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L135_C4", "label": "assertEquals()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [8, 2, 0.931, 0.0069, 2, 0.76, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', multi.foo)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L136_C4", "label": "assertEquals()", "type": "expression", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "vector": [8, 2, 0.9379, 0.0069, 2, 0.76, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('bar', multi.bar)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "label": "testParseMarkup", "type": "function", "loc": [138, 142], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "vector": [2, 1, 0.9655, 0.0345, 1, 0.97, 1.0, 78, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testParseMarkup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testParseMarkup(self):\n self.assertEquals('foo', util.parse_markup('foo'))\n self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))\n self.assertEquals('foo\\nbar', util.parse_markup('foo<br>bar'))\n self.assertEquals('foo\\nbar', util.parse_markup('foo<p indent=\"3\">bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L139_C4", "label": "assertEquals()", "type": "expression", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "vector": [8, 2, 0.9586, 0.0069, 2, 0.9, 0.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo', util.parse_markup('foo'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L140_C4", "label": "assertEquals()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "vector": [8, 2, 0.9655, 0.0069, 2, 0.9, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo bar', util.parse_markup('foo <b>bar</b>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "vector": [8, 2, 0.9724, 0.0069, 2, 0.9, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo\\nbar', util.parse_markup('foo<br>bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L142_C4", "label": "assertEquals()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "vector": [8, 2, 0.9793, 0.0069, 2, 0.9, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('foo\\nbar', util.parse_markup('foo<p indent=\"3\">bar'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:If_L144_C0", "label": "if", "type": "if", "loc": [144, 145], "level": 0, "parent": null, "vector": [4, 0, 0.9966, 0.0138, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L145_C2", "label": "main()", "type": "expression", "loc": [145, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1121:If_L144_C0", "vector": [8, 1, 1.0, 0.0069, 1, 0.01, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L32_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L79_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:For_L84_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L85_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L117_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L118_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L116_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L115_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L121_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L113_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:ClassDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:FunctionDef_L138_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1121:If_L144_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1121:Expr_L145_C2"}] |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Run robot from the commandline for testing.
This robot_runner let's you define event handlers using flags and takes the
json input from the std in and writes out the json output to stdout.
for example
cat events | commandline_robot_runner.py \
--eventdef-blip_submitted="wavelet.title='title'"
"""
__author__ = 'douwe@google.com (Douwe Osinga)'
import sys
import urllib
from google3.pyglib import app
from google3.pyglib import flags
from google3.walkabout.externalagents import api
from google3.walkabout.externalagents.api import blip
from google3.walkabout.externalagents.api import element
from google3.walkabout.externalagents.api import errors
from google3.walkabout.externalagents.api import events
from google3.walkabout.externalagents.api import ops
from google3.walkabout.externalagents.api import robot
from google3.walkabout.externalagents.api import util
FLAGS = flags.FLAGS
for event in events.ALL:
flags.DEFINE_string('eventdef_' + event.type.lower(),
'',
'Event definition for the %s event' % event.type)
def handle_event(src, bot, e, w):
"""Handle an event by executing the source code src."""
globs = {'e': e, 'w': w, 'api': api, 'bot': bot,
'blip': blip, 'element': element, 'errors': errors,
'events': events, 'ops': ops, 'robot': robot,
'util': util}
exec src in globs
def run_bot(input_file, output_file):
"""Run a robot defined on the command line."""
cmdbot = robot.Robot('Commandline bot')
for event in events.ALL:
src = getattr(FLAGS, 'eventdef_' + event.type.lower())
src = urllib.unquote_plus(src)
if src:
cmdbot.register_handler(event,
lambda event, wavelet, src=src, bot=cmdbot:
handle_event(src, bot, event, wavelet))
json_body = unicode(input_file.read(), 'utf8')
json_response = cmdbot.process_events(json_body)
output_file.write(json_response)
def main(argv):
run_bot(sys.stdin, sys.stdout)
if __name__ == '__main__':
app.run()
| ajibawa-2023/Python-Code-Large/train/row_1122 | 36 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 13], "level": 0, "parent": null, "vector": [8, 0, 0.1304, 0.1304, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Run robot from the commandline for testing.\n\nThis robot_runner let's you define event handlers using flags and takes the\njson input from the std in and writes out the json output to stdout.\n\nfor example\n cat events | commandline_robot_runner.py \\\n --eventdef-blip_submitted=\"wavelet.title='title'\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L15_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [15, 15], "level": 0, "parent": null, "vector": [14, 0, 0.2174, 0.0145, 0, 0.66, 0.0526, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'douwe@google.com (Douwe Osinga)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Import_L17_C0", "label": "sys import sys", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2464, 0.0145, 0, 0.66, 0.1053, 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_1122:Import_L18_C0", "label": "urllib import urllib", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.2609, 0.0145, 0, 0.66, 0.1579, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L20_C0", "label": "from google3.pyglib import app", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2899, 0.0145, 0, 0.66, 0.2105, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L21_C0", "label": "from google3.pyglib import flags", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.3043, 0.0145, 0, 0.66, 0.2632, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["flags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L23_C0", "label": "from google3.walkabout.externalagents import api", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0145, 0, 0.66, 0.3158, 770, 0, 1, 0, 0, 770, 0, 0], "semantic": {"name": "google3.walkabout.externalagents", "arg_names": [], "import_names": ["api"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents import api"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L25_C0", "label": "from google3.walkabout.externalagents.api import blip", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3623, 0.0145, 0, 0.66, 0.3684, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L26_C0", "label": "from google3.walkabout.externalagents.api import element", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.3768, 0.0145, 0, 0.66, 0.4211, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L27_C0", "label": "from google3.walkabout.externalagents.api import errors", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3913, 0.0145, 0, 0.66, 0.4737, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L28_C0", "label": "from google3.walkabout.externalagents.api import events", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.4058, 0.0145, 0, 0.66, 0.5263, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L29_C0", "label": "from google3.walkabout.externalagents.api import ops", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.4203, 0.0145, 0, 0.66, 0.5789, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L30_C0", "label": "from google3.walkabout.externalagents.api import robot", "type": "import", "loc": [30, 30], "level": 0, "parent": null, "vector": [1, 0, 0.4348, 0.0145, 0, 0.66, 0.6316, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:ImportFrom_L31_C0", "label": "from google3.walkabout.externalagents.api import util", "type": "import", "loc": [31, 31], "level": 0, "parent": null, "vector": [1, 0, 0.4493, 0.0145, 0, 0.66, 0.6842, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L33_C0", "label": "FLAGS =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.4783, 0.0145, 0, 0.66, 0.7368, 578, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLAGS = flags.FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L35_C0", "label": "for event", "type": "for", "loc": [35, 38], "level": 0, "parent": null, "vector": [6, 0, 0.529, 0.058, 0, 0.66, 0.7895, 371, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for event in events.ALL:\n flags.DEFINE_string('eventdef_' + event.type.lower(),\n '',\n 'Event definition for the %s event' % event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L36_C2", "label": "DEFINE_string()", "type": "expression", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L35_C0", "vector": [8, 1, 0.5362, 0.0435, 1, 0.44, 0.0, 430, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "DEFINE_string", "arg_names": [], "import_names": [], "rhs_call_name": "DEFINE_string", "annotation": ""}, "snippet": " flags.DEFINE_string('eventdef_' + event.type.lower(),\n '',\n 'Event definition for the %s event' % event.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "label": "handle_event", "type": "function", "loc": [41, 47], "level": 0, "parent": null, "vector": [2, 0, 0.6377, 0.1014, 0, 0.66, 0.8421, 48, 0, 4, 0, 0, 0, 0, 1], "semantic": {"name": "handle_event", "arg_names": ["src", "bot", "e", "w"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def handle_event(src, bot, e, w):\n \"\"\"Handle an event by executing the source code src.\"\"\"\n globs = {'e': e, 'w': w, 'api': api, 'bot': bot,\n 'blip': blip, 'element': element, 'errors': errors,\n 'events': events, 'ops': ops, 'robot': robot,\n 'util': util}\n exec(src in globs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L42_C2", "label": "expression", "type": "expression", "loc": [42, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "vector": [8, 1, 0.6087, 0.0145, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handle an event by executing the source code src.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L43_C2", "label": "globs =", "type": "assigned_variable", "loc": [43, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "vector": [14, 1, 0.6449, 0.058, 1, 0.4, 0.5, 74, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "globs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " globs = {'e': e, 'w': w, 'api': api, 'bot': bot,\n 'blip': blip, 'element': element, 'errors': errors,\n 'events': events, 'ops': ops, 'robot': robot,\n 'util': util}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L47_C2", "label": "exec()", "type": "expression", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "vector": [8, 1, 0.6812, 0.0145, 1, 0.4, 1.0, 272, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exec", "arg_names": [], "import_names": [], "rhs_call_name": "exec", "annotation": ""}, "snippet": " exec(src in globs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "label": "run_bot", "type": "function", "loc": [50, 62], "level": 0, "parent": null, "vector": [2, 0, 0.8116, 0.1884, 0, 0.66, 0.8947, 707, 0, 2, 0, 0, 0, 0, 10], "semantic": {"name": "run_bot", "arg_names": ["input_file", "output_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run_bot(input_file, output_file):\n \"\"\"Run a robot defined on the command line.\"\"\"\n cmdbot = robot.Robot('Commandline bot')\n for event in events.ALL:\n src = getattr(FLAGS, 'eventdef_' + event.type.lower())\n src = urllib.unquote_plus(src)\n if src:\n cmdbot.register_handler(event,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [8, 1, 0.7391, 0.0145, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Run a robot defined on the command line.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L52_C2", "label": "cmdbot = Robot()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [14, 1, 0.7536, 0.0145, 1, 0.97, 0.2, 293, 3, 1, 0, 0, 440, 10, 1], "semantic": {"name": "cmdbot", "arg_names": [], "import_names": [], "rhs_call_name": "Robot", "annotation": ""}, "snippet": " cmdbot = robot.Robot('Commandline bot')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "label": "for event", "type": "for", "loc": [53, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [6, 1, 0.8116, 0.1014, 1, 0.97, 0.4, 371, 7, 0, 0, 0, 0, 0, 5], "semantic": {"name": "event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for event in events.ALL:\n src = getattr(FLAGS, 'eventdef_' + event.type.lower())\n src = urllib.unquote_plus(src)\n if src:\n cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L54_C4", "label": "src = getattr()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "vector": [14, 2, 0.7826, 0.0145, 2, 0.37, 0.0, 345, 3, 2, 0, 0, 121, 10, 2], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " src = getattr(FLAGS, 'eventdef_' + event.type.lower())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L55_C4", "label": "src = unquote_plus()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "vector": [14, 2, 0.7971, 0.0145, 2, 0.37, 0.5, 345, 3, 1, 0, 0, 449, 10, 1], "semantic": {"name": "src", "arg_names": [], "import_names": [], "rhs_call_name": "unquote_plus", "annotation": ""}, "snippet": " src = urllib.unquote_plus(src)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L56_C4", "label": "if", "type": "if", "loc": [56, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "vector": [4, 2, 0.8333, 0.058, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if src:\n cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L57_C6", "label": "register_handler()", "type": "expression", "loc": [57, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L56_C4", "vector": [8, 3, 0.8406, 0.0435, 3, 0.87, 0.0, 116, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " cmdbot.register_handler(event,\n lambda event, wavelet, src=src, bot=cmdbot:\n handle_event(src, bot, event, wavelet))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L60_C2", "label": "json_body = unicode()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [14, 1, 0.8696, 0.0145, 1, 0.97, 0.6, 958, 3, 2, 0, 0, 733, 10, 2], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " json_body = unicode(input_file.read(), 'utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L61_C2", "label": "json_response = process_events()", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [14, 1, 0.8841, 0.0145, 1, 0.97, 0.8, 870, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json_response", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json_response = cmdbot.process_events(json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L62_C2", "label": "write()", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "vector": [8, 1, 0.8986, 0.0145, 1, 0.97, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " output_file.write(json_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L65_C0", "label": "main", "type": "function", "loc": [65, 66], "level": 0, "parent": null, "vector": [2, 0, 0.9493, 0.029, 0, 0.66, 0.9474, 624, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": ["argv"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main(argv):\n run_bot(sys.stdin, sys.stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L66_C2", "label": "run_bot()", "type": "expression", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L65_C0", "vector": [8, 1, 0.9565, 0.0145, 1, 0.61, 0.0, 707, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run_bot", "arg_names": [], "import_names": [], "rhs_call_name": "run_bot", "annotation": ""}, "snippet": " run_bot(sys.stdin, sys.stdout)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L68_C0", "label": "if", "type": "if", "loc": [68, 69], "level": 0, "parent": null, "vector": [4, 0, 0.9928, 0.029, 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 app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L69_C2", "label": "run()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L68_C0", "vector": [8, 1, 1.0, 0.0145, 1, 0.53, 0.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " app.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L42_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L41_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:For_L53_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1122:If_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1122:Expr_L69_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Support for operations that can be applied to the server.
Contains classes and utilities for creating operations that are to be
applied on the server.
"""
import errors
import random
import util
import sys
PROTOCOL_VERSION = '0.21'
# Operation Types
WAVELET_APPEND_BLIP = 'wavelet.appendBlip'
WAVELET_SET_TITLE = 'wavelet.setTitle'
WAVELET_ADD_PARTICIPANT = 'wavelet.participant.add'
WAVELET_DATADOC_SET = 'wavelet.datadoc.set'
WAVELET_MODIFY_TAG = 'wavelet.modifyTag'
WAVELET_MODIFY_PARTICIPANT_ROLE = 'wavelet.modifyParticipantRole'
BLIP_CREATE_CHILD = 'blip.createChild'
BLIP_DELETE = 'blip.delete'
DOCUMENT_APPEND_MARKUP = 'document.appendMarkup'
DOCUMENT_INLINE_BLIP_INSERT = 'document.inlineBlip.insert'
DOCUMENT_MODIFY = 'document.modify'
ROBOT_CREATE_WAVELET = 'robot.createWavelet'
ROBOT_FETCH_WAVE = 'robot.fetchWave'
ROBOT_NOTIFY_CAPABILITIES_HASH = 'robot.notifyCapabilitiesHash'
class Operation(object):
"""Represents a generic operation applied on the server.
This operation class contains data that is filled in depending on the
operation type.
It can be used directly, but doing so will not result
in local, transient reflection of state on the blips. In other words,
creating a 'delete blip' operation will not remove the blip from the local
context for the duration of this session. It is better to use the OpBased
model classes directly instead.
"""
def __init__(self, method, opid, params):
"""Initializes this operation with contextual data.
Args:
method: Method to call or type of operation.
opid: The id of the operation. Any callbacks will refer to these.
params: An operation type dependent dictionary
"""
self.method = method
self.id = opid
self.params = params
def __str__(self):
return '%s[%s]%s' % (self.method, self.id, str(self.params))
def set_param(self, param, value):
self.params[param] = value
return self
def serialize(self, method_prefix=''):
"""Serialize the operation.
Args:
method_prefix: prefixed for each method name to allow for specifying
a namespace.
Returns:
a dict representation of the operation.
"""
if method_prefix and not method_prefix.endswith('.'):
method_prefix += '.'
return {'method': method_prefix + self.method,
'id': self.id,
'params': util.serialize(self.params)}
def set_optional(self, param, value):
"""Sets an optional parameter.
If value is None or "", this is a no op. Otherwise it calls
set_param.
"""
if value == '' or value is None:
return self
else:
return self.set_param(param, value)
class OperationQueue(object):
"""Wraps the queuing of operations using easily callable functions.
The operation queue wraps single operations as functions and queues the
resulting operations in-order. Typically there shouldn't be a need to
call this directly unless operations are needed on entities outside
of the scope of the robot. For example, to modify a blip that
does not exist in the current context, you might specify the wave, wavelet
and blip id to generate an operation.
Any calls to this will not be reflected in the robot in any way.
For example, calling wavelet_append_blip will not result in a new blip
being added to the robot, only an operation to be applied on the
server.
"""
# Some class global counters:
_next_operation_id = 1
def __init__(self, proxy_for_id=None):
self.__pending = []
self._capability_hash = 0
self._proxy_for_id = proxy_for_id
def _new_blipdata(self, wave_id, wavelet_id, initial_content='',
parent_blip_id=None):
"""Creates JSON of the blip used for this session."""
temp_blip_id = 'TBD_%s_%s' % (wavelet_id,
hex(random.randint(0, sys.maxint)))
return {'waveId': wave_id,
'waveletId': wavelet_id,
'blipId': temp_blip_id,
'content': initial_content,
'parentBlipId': parent_blip_id}
def _new_waveletdata(self, domain, participants):
"""Creates an ephemeral WaveletData instance used for this session.
Args:
domain: the domain to create the data for.
participants initially on the wavelet
Returns:
Blipdata (for the rootblip), WaveletData.
"""
wave_id = domain + '!TBD_%s' % hex(random.randint(0, sys.maxint))
wavelet_id = domain + '!conv+root'
root_blip_data = self._new_blipdata(wave_id, wavelet_id)
participants = set(participants)
wavelet_data = {'waveId': wave_id,
'waveletId': wavelet_id,
'rootBlipId': root_blip_data['blipId'],
'participants': participants}
return root_blip_data, wavelet_data
def __len__(self):
return len(self.__pending)
def __iter__(self):
return self.__pending.__iter__()
def clear(self):
self.__pending = []
def proxy_for(self, proxy):
"""Return a view of this operation queue with the proxying for set to proxy.
This method returns a new instance of an operation queue that shares the
operation list, but has a different proxying_for_id set so the robot using
this new queue will send out operations with the proxying_for field set.
"""
res = OperationQueue()
res.__pending = self.__pending
res._capability_hash = self._capability_hash
res._proxy_for_id = proxy
return res
def set_capability_hash(self, capability_hash):
self._capability_hash = capability_hash
def serialize(self):
first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,
'0',
{'capabilitiesHash': self._capability_hash,
'protocolVersion': PROTOCOL_VERSION})
operations = [first] + self.__pending
res = util.serialize(operations)
return res
def copy_operations(self, other_queue):
"""Copy the pending operations from other_queue into this one."""
for op in other_queue:
self.__pending.append(op)
def new_operation(self, method, wave_id, wavelet_id, props=None, **kwprops):
"""Creates and adds a new operation to the operation list."""
if props is None:
props = {}
props.update(kwprops)
props['waveId'] = wave_id
props['waveletId'] = wavelet_id
if self._proxy_for_id:
props['proxyingFor'] = self._proxy_for_id
operation = Operation(method,
'op%s' % OperationQueue._next_operation_id,
props)
self.__pending.append(operation)
OperationQueue._next_operation_id += 1
return operation
def wavelet_append_blip(self, wave_id, wavelet_id, initial_content=''):
"""Appends a blip to a wavelet.
Args:
wave_id: The wave id owning the containing wavelet.
wavelet_id: The wavelet id that this blip should be appended to.
initial_content: optionally the content to start with
Returns:
JSON representing the information of the new blip.
"""
blip_data = self._new_blipdata(wave_id, wavelet_id, initial_content)
self.new_operation(WAVELET_APPEND_BLIP, wave_id,
wavelet_id, blipData=blip_data)
return blip_data
def wavelet_add_participant(self, wave_id, wavelet_id, participant_id):
"""Adds a participant to a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
participant_id: Id of the participant to add.
Returns:
data for the root_blip, wavelet
"""
return self.new_operation(WAVELET_ADD_PARTICIPANT, wave_id, wavelet_id,
participantId=participant_id)
def wavelet_datadoc_set(self, wave_id, wavelet_id, name, data):
"""Sets a key/value pair on the data document of a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
name: The key name for this data.
data: The value of the data to set.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_DATADOC_SET, wave_id, wavelet_id,
datadocName=name, datadocValue=data)
def robot_create_wavelet(self, domain, participants=None, message=''):
"""Creates a new wavelet.
Args:
domain: the domain to create the wave in
participants: initial participants on this wavelet or None if none
message: an optional payload that is returned with the corresponding
event.
Returns:
data for the root_blip, wavelet
"""
if participants is None:
participants = []
blip_data, wavelet_data = self._new_waveletdata(domain, participants)
op = self.new_operation(ROBOT_CREATE_WAVELET,
wave_id=wavelet_data['waveId'],
wavelet_id=wavelet_data['waveletId'],
waveletData=wavelet_data)
op.set_optional('message', message)
return blip_data, wavelet_data
def robot_fetch_wave(self, wave_id, wavelet_id):
"""Requests a snapshot of the specified wave.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(ROBOT_FETCH_WAVE, wave_id, wavelet_id)
def wavelet_set_title(self, wave_id, wavelet_id, title):
"""Sets the title of a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
title: The title to set.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_SET_TITLE, wave_id, wavelet_id,
waveletTitle=title)
def wavelet_modify_participant_role(
self, wave_id, wavelet_id, participant_id, role):
"""Modify the role of a participant on a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
participant_id: Id of the participant to add.
role: the new roles
Returns:
data for the root_blip, wavelet
"""
return self.new_operation(WAVELET_MODIFY_PARTICIPANT_ROLE, wave_id,
wavelet_id, participantId=participant_id,
participantRole=role)
def wavelet_modify_tag(self, wave_id, wavelet_id, tag, modify_how=None):
"""Modifies a tag in a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
tag: The tag (a string).
modify_how: (optional) how to apply the tag. The default is to add
the tag. Specify 'remove' to remove. Specify None or 'add' to
add.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_MODIFY_TAG, wave_id, wavelet_id,
name=tag).set_optional("modify_how", modify_how)
def blip_create_child(self, wave_id, wavelet_id, blip_id):
"""Creates a child blip of another blip.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
JSON of blip for which further operations can be applied.
"""
blip_data = self._new_blipdata(wave_id, wavelet_id, parent_blip_id=blip_id)
self.new_operation(BLIP_CREATE_CHILD, wave_id, wavelet_id,
blipId=blip_id,
blipData=blip_data)
return blip_data
def blip_delete(self, wave_id, wavelet_id, blip_id):
"""Deletes the specified blip.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(BLIP_DELETE, wave_id, wavelet_id, blipId=blip_id)
def document_append_markup(self, wave_id, wavelet_id, blip_id, content):
"""Appends content with markup to a document.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
content: The markup content to append.
Returns:
The operation created.
"""
return self.new_operation(DOCUMENT_APPEND_MARKUP, wave_id, wavelet_id,
blipId=blip_id, content=content)
def document_modify(self, wave_id, wavelet_id, blip_id):
"""Creates and queues a document modify operation
The returned operation still needs to be filled with details before
it makes sense.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(DOCUMENT_MODIFY,
wave_id,
wavelet_id,
blipId=blip_id)
def document_inline_blip_insert(self, wave_id, wavelet_id, blip_id, position):
"""Inserts an inline blip at a specific location.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
position: The position in the document to insert the blip.
Returns:
JSON data for the blip that was created for further operations.
"""
inline_blip_data = self._new_blipdata(wave_id, wavelet_id)
inline_blip_data['parentBlipId'] = blip_id
self.new_operation(DOCUMENT_INLINE_BLIP_INSERT, wave_id, wavelet_id,
blipId=blip_id,
index=position,
blipData=inline_blip_data)
return inline_blip_data
| ajibawa-2023/Python-Code-Large/train/row_1123 | 147 | 419 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.0453, 0.0119, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Support for operations that can be applied to the server.\n\nContains classes and utilities for creating operations that are to be\napplied on the server.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Import_L23_C0", "label": "errors import errors", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0549, 0.0024, 0, 0.66, 0.0476, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Import_L24_C0", "label": "random import random", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0573, 0.0024, 0, 0.66, 0.0952, 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_1123:Import_L25_C0", "label": "util import util", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0024, 0, 0.66, 0.1429, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Import_L26_C0", "label": "sys import sys", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0621, 0.0024, 0, 0.66, 0.1905, 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_1123:Assign_L29_C0", "label": "PROTOCOL_VERSION =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.0692, 0.0024, 0, 0.66, 0.2381, 310, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PROTOCOL_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PROTOCOL_VERSION = '0.21'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L32_C0", "label": "WAVELET_APPEND_BLIP =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.0764, 0.0024, 0, 0.66, 0.2857, 78, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_APPEND_BLIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_APPEND_BLIP = 'wavelet.appendBlip'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L33_C0", "label": "WAVELET_SET_TITLE =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.0788, 0.0024, 0, 0.66, 0.3333, 503, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_SET_TITLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_SET_TITLE = 'wavelet.setTitle'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L34_C0", "label": "WAVELET_ADD_PARTICIPANT =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.0811, 0.0024, 0, 0.66, 0.381, 164, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_ADD_PARTICIPANT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_ADD_PARTICIPANT = 'wavelet.participant.add'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L35_C0", "label": "WAVELET_DATADOC_SET =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.0835, 0.0024, 0, 0.66, 0.4286, 904, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_DATADOC_SET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_DATADOC_SET = 'wavelet.datadoc.set'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L36_C0", "label": "WAVELET_MODIFY_TAG =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.0859, 0.0024, 0, 0.66, 0.4762, 603, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_MODIFY_TAG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_MODIFY_TAG = 'wavelet.modifyTag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L37_C0", "label": "WAVELET_MODIFY_PARTICIPANT_ROLE =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.0883, 0.0024, 0, 0.66, 0.5238, 318, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_MODIFY_PARTICIPANT_ROLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_MODIFY_PARTICIPANT_ROLE = 'wavelet.modifyParticipantRole'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L38_C0", "label": "BLIP_CREATE_CHILD =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.0907, 0.0024, 0, 0.66, 0.5714, 233, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_CREATE_CHILD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_CREATE_CHILD = 'blip.createChild'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L39_C0", "label": "BLIP_DELETE =", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.0931, 0.0024, 0, 0.66, 0.619, 775, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_DELETE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_DELETE = 'blip.delete'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L40_C0", "label": "DOCUMENT_APPEND_MARKUP =", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.0955, 0.0024, 0, 0.66, 0.6667, 593, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_APPEND_MARKUP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_APPEND_MARKUP = 'document.appendMarkup'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L41_C0", "label": "DOCUMENT_INLINE_BLIP_INSERT =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.0979, 0.0024, 0, 0.66, 0.7143, 604, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_INLINE_BLIP_INSERT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_INLINE_BLIP_INSERT = 'document.inlineBlip.insert'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L42_C0", "label": "DOCUMENT_MODIFY =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.1002, 0.0024, 0, 0.66, 0.7619, 23, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_MODIFY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_MODIFY = 'document.modify'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L43_C0", "label": "ROBOT_CREATE_WAVELET =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.1026, 0.0024, 0, 0.66, 0.8095, 423, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_CREATE_WAVELET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_CREATE_WAVELET = 'robot.createWavelet'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L44_C0", "label": "ROBOT_FETCH_WAVE =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.105, 0.0024, 0, 0.66, 0.8571, 617, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_FETCH_WAVE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_FETCH_WAVE = 'robot.fetchWave'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L45_C0", "label": "ROBOT_NOTIFY_CAPABILITIES_HASH =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.1074, 0.0024, 0, 0.66, 0.9048, 438, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_NOTIFY_CAPABILITIES_HASH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_NOTIFY_CAPABILITIES_HASH = 'robot.notifyCapabilitiesHash'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "label": "Operation", "type": "class", "loc": [48, 105], "level": 0, "parent": null, "vector": [3, 0, 0.1826, 0.1384, 0, 0.66, 0.9524, 222, 0, 5, 0, 0, 186, 0, 4], "semantic": {"name": "Operation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Operation(object):\n \"\"\"Represents a generic operation applied on the server.\n\n This operation class contains data that is filled in depending on the\n operation type.\n\n It can be used directly, but doing so will not result\n in local, transient reflection of state on the blips. In other words,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [8, 1, 0.1289, 0.0263, 1, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Represents a generic operation applied on the server.\n\n This operation class contains data that is filled in depending on the\n operation type.\n\n It can be used directly, but doing so will not result\n in local, transient reflection of state on the blips. In other words,\n creating a 'delete blip' operation will not remove the blip from the local"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "label": "__init__", "type": "function", "loc": [61, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [2, 1, 0.1575, 0.0263, 1, 0.84, 0.2, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "opid", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, opid, params):\n \"\"\"Initializes this operation with contextual data.\n\n Args:\n method: Method to call or type of operation.\n opid: The id of the operation. Any callbacks will refer to these.\n params: An operation type dependent dictionary\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "vector": [8, 2, 0.1551, 0.0167, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this operation with contextual data.\n\n Args:\n method: Method to call or type of operation.\n opid: The id of the operation. Any callbacks will refer to these.\n params: An operation type dependent dictionary\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L69_C4", "label": "self.method =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "vector": [14, 2, 0.1647, 0.0024, 2, 0.79, 0.3333, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L70_C4", "label": "self.id =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "vector": [14, 2, 0.1671, 0.0024, 2, 0.79, 0.6667, 485, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.id = opid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L71_C4", "label": "self.params =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "vector": [14, 2, 0.1695, 0.0024, 2, 0.79, 1.0, 402, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L73_C2", "label": "__str__", "type": "function", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [2, 1, 0.1754, 0.0048, 1, 0.84, 0.4, 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]%s' % (self.method, self.id, str(self.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L73_C2", "vector": [13, 2, 0.1766, 0.0024, 2, 0.74, 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' % (self.method, self.id, str(self.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2", "label": "set_param", "type": "function", "loc": [76, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [2, 1, 0.1838, 0.0072, 1, 0.84, 0.6, 696, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "set_param", "arg_names": ["self", "param", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_param(self, param, value):\n self.params[param] = value\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L77_C4", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2", "vector": [14, 2, 0.1838, 0.0024, 2, 0.11, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params[param] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L78_C4", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2", "vector": [13, 2, 0.1862, 0.0024, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "label": "serialize", "type": "function", "loc": [80, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [2, 1, 0.2076, 0.0358, 1, 0.84, 0.8, 50, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self", "method_prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self, method_prefix=''):\n \"\"\"Serialize the operation.\n\n Args:\n method_prefix: prefixed for each method name to allow for specifying\n a namespace.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L81_C4", "label": "expression", "type": "expression", "loc": [81, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "vector": [8, 2, 0.2029, 0.0215, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize the operation.\n\n Args:\n method_prefix: prefixed for each method name to allow for specifying\n a namespace.\n\n Returns:\n a dict representation of the operation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L90_C4", "label": "if", "type": "if", "loc": [90, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "vector": [4, 2, 0.216, 0.0048, 2, 0.37, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if method_prefix and not method_prefix.endswith('.'):\n method_prefix += '.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L92_C4", "label": "return", "type": "return", "loc": [92, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "vector": [13, 2, 0.222, 0.0072, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'method': method_prefix + self.method,\n 'id': self.id,\n 'params': util.serialize(self.params)}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2", "label": "set_optional", "type": "function", "loc": [96, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "vector": [2, 1, 0.2399, 0.0239, 1, 0.84, 1.0, 517, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "set_optional", "arg_names": ["self", "param", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_optional(self, param, value):\n \"\"\"Sets an optional parameter.\n\n If value is None or \"\", this is a no op. Otherwise it calls\n set_param.\n \"\"\"\n if value == '' or value is None:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L97_C4", "label": "expression", "type": "expression", "loc": [97, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2", "vector": [8, 2, 0.2363, 0.0119, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets an optional parameter.\n\n If value is None or \"\", this is a no op. Otherwise it calls\n set_param.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4", "label": "if", "type": "if", "loc": [102, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2", "vector": [4, 2, 0.247, 0.0095, 2, 0.93, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value == '' or value is None:\n return self\n else:\n return self.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L103_C6", "label": "return", "type": "return", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4", "vector": [13, 3, 0.2458, 0.0024, 3, 0.28, 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_1123:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4", "vector": [13, 3, 0.2506, 0.0024, 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.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "label": "OperationQueue", "type": "class", "loc": [108, 419], "level": 0, "parent": null, "vector": [3, 0, 0.6289, 0.7446, 0, 0.66, 1.0, 786, 0, 24, 0, 0, 186, 0, 34], "semantic": {"name": "OperationQueue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OperationQueue(object):\n \"\"\"Wraps the queuing of operations using easily callable functions.\n\n The operation queue wraps single operations as functions and queues the\n resulting operations in-order. Typically there shouldn't be a need to\n call this directly unless operations are needed on entities outside\n of the scope of the robot. For example, to modify a blip that\n does not exist in the current context, you might specify the wave, wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [8, 1, 0.2757, 0.0334, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Wraps the queuing of operations using easily callable functions.\n\n The operation queue wraps single operations as functions and queues the\n resulting operations in-order. Typically there shouldn't be a need to\n call this directly unless operations are needed on entities outside\n of the scope of the robot. For example, to modify a blip that\n does not exist in the current context, you might specify the wave, wavelet\n and blip id to generate an operation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L125_C2", "label": "_next_operation_id =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [14, 1, 0.2983, 0.0024, 1, 0.08, 0.04, 881, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_next_operation_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _next_operation_id = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "label": "__init__", "type": "function", "loc": [127, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.3067, 0.0095, 1, 0.08, 0.08, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, proxy_for_id=None):\n self.__pending = []\n self._capability_hash = 0\n self._proxy_for_id = proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L128_C4", "label": "self.__pending =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "vector": [14, 2, 0.3055, 0.0024, 2, 0.18, 0.0, 111, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L129_C4", "label": "self._capability_hash =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "vector": [14, 2, 0.3079, 0.0024, 2, 0.18, 0.5, 684, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._capability_hash = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L130_C4", "label": "self._proxy_for_id =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "vector": [14, 2, 0.3103, 0.0024, 2, 0.18, 1.0, 288, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._proxy_for_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._proxy_for_id = proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "label": "_new_blipdata", "type": "function", "loc": [132, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.3258, 0.0239, 1, 0.08, 0.12, 656, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "_new_blipdata", "arg_names": ["self", "wave_id", "wavelet_id", "initial_content", "parent_blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _new_blipdata(self, wave_id, wavelet_id, initial_content='',\n parent_blip_id=None):\n \"\"\"Creates JSON of the blip used for this session.\"\"\"\n temp_blip_id = 'TBD_%s_%s' % (wavelet_id,\n hex(random.randint(0, sys.maxint)))\n return {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'blipId': temp_blip_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L134_C4", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "vector": [8, 2, 0.3198, 0.0024, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates JSON of the blip used for this session.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L135_C4", "label": "temp_blip_id =", "type": "assigned_variable", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "vector": [14, 2, 0.3234, 0.0048, 2, 0.98, 0.5, 823, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "temp_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp_blip_id = 'TBD_%s_%s' % (wavelet_id,\n hex(random.randint(0, sys.maxint)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L137_C4", "label": "return", "type": "return", "loc": [137, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "vector": [13, 2, 0.3317, 0.0119, 2, 0.98, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'blipId': temp_blip_id,\n 'content': initial_content,\n 'parentBlipId': parent_blip_id}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "label": "_new_waveletdata", "type": "function", "loc": [143, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.3616, 0.043, 1, 0.08, 0.16, 138, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "_new_waveletdata", "arg_names": ["self", "domain", "participants"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _new_waveletdata(self, domain, participants):\n \"\"\"Creates an ephemeral WaveletData instance used for this session.\n\n Args:\n domain: the domain to create the data for.\n participants initially on the wavelet\n Returns:\n Blipdata (for the rootblip), WaveletData."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L144_C4", "label": "expression", "type": "expression", "loc": [144, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [8, 2, 0.352, 0.0191, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates an ephemeral WaveletData instance used for this session.\n\n Args:\n domain: the domain to create the data for.\n participants initially on the wavelet\n Returns:\n Blipdata (for the rootblip), WaveletData.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L152_C4", "label": "wave_id =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [14, 2, 0.3628, 0.0024, 2, 0.24, 0.1667, 347, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wave_id = domain + '!TBD_%s' % hex(random.randint(0, sys.maxint))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L153_C4", "label": "wavelet_id =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [14, 2, 0.3652, 0.0024, 2, 0.24, 0.3333, 269, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet_id = domain + '!conv+root'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L154_C4", "label": "root_blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [14, 2, 0.3675, 0.0024, 2, 0.24, 0.5, 28, 3, 2, 0, 0, 656, 10, 1], "semantic": {"name": "root_blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " root_blip_data = self._new_blipdata(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L155_C4", "label": "participants = set()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [14, 2, 0.3699, 0.0024, 2, 0.24, 0.6667, 572, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "participants", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " participants = set(participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L156_C4", "label": "wavelet_data =", "type": "assigned_variable", "loc": [156, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [14, 2, 0.3759, 0.0095, 2, 0.24, 0.8333, 467, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "wavelet_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet_data = {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'rootBlipId': root_blip_data['blipId'],\n 'participants': participants}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L160_C4", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "vector": [13, 2, 0.3819, 0.0024, 2, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return root_blip_data, wavelet_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L162_C2", "label": "__len__", "type": "function", "loc": [162, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.3878, 0.0048, 1, 0.08, 0.2, 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 return len(self.__pending)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L163_C4", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L162_C2", "vector": [13, 2, 0.389, 0.0024, 2, 0.14, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.__pending)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L165_C2", "label": "__iter__", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.395, 0.0048, 1, 0.08, 0.24, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self.__pending.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L166_C4", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L165_C2", "vector": [13, 2, 0.3962, 0.0024, 2, 0.13, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__pending.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L168_C2", "label": "clear", "type": "function", "loc": [168, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4021, 0.0048, 1, 0.08, 0.28, 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 self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L169_C4", "label": "self.__pending =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L168_C2", "vector": [14, 2, 0.4033, 0.0024, 2, 0.92, 0.0, 111, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "label": "proxy_for", "type": "function", "loc": [171, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4212, 0.0286, 1, 0.08, 0.32, 365, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy):\n \"\"\"Return a view of this operation queue with the proxying for set to proxy.\n\n This method returns a new instance of an operation queue that shares the\n operation list, but has a different proxying_for_id set so the robot using\n this new queue will send out operations with the proxying_for field set.\n \"\"\"\n res = OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [8, 2, 0.4165, 0.0143, 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 a view of this operation queue with the proxying for set to proxy.\n\n This method returns a new instance of an operation queue that shares the\n operation list, but has a different proxying_for_id set so the robot using\n this new queue will send out operations with the proxying_for field set.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L178_C4", "label": "res = OperationQueue()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [14, 2, 0.4248, 0.0024, 2, 0.36, 0.2, 413, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " res = OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L179_C4", "label": "res.__pending =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [14, 2, 0.4272, 0.0024, 2, 0.36, 0.4, 370, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res.__pending = self.__pending"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L180_C4", "label": "res._capability_hash =", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [14, 2, 0.4296, 0.0024, 2, 0.36, 0.6, 60, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._capability_hash = self._capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L181_C4", "label": "res._proxy_for_id =", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [14, 2, 0.432, 0.0024, 2, 0.36, 0.8, 985, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._proxy_for_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._proxy_for_id = proxy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "vector": [13, 2, 0.4344, 0.0024, 2, 0.36, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L184_C2", "label": "set_capability_hash", "type": "function", "loc": [184, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4403, 0.0048, 1, 0.08, 0.36, 954, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_capability_hash", "arg_names": ["self", "capability_hash"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_capability_hash(self, capability_hash):\n self._capability_hash = capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L185_C4", "label": "self._capability_hash =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L184_C2", "vector": [14, 2, 0.4415, 0.0024, 2, 0.9, 0.0, 684, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._capability_hash = capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "label": "serialize", "type": "function", "loc": [187, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4547, 0.0191, 1, 0.08, 0.4, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,\n '0',\n {'capabilitiesHash': self._capability_hash,\n 'protocolVersion': PROTOCOL_VERSION})\n operations = [first] + self.__pending\n res = util.serialize(operations)\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L188_C4", "label": "first = Operation()", "type": "assigned_variable", "loc": [188, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "vector": [14, 2, 0.4523, 0.0095, 2, 0.15, 0.0, 199, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,\n '0',\n {'capabilitiesHash': self._capability_hash,\n 'protocolVersion': PROTOCOL_VERSION})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L192_C4", "label": "operations =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "vector": [14, 2, 0.4582, 0.0024, 2, 0.15, 0.3333, 962, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " operations = [first] + self.__pending"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L193_C4", "label": "res = serialize()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "vector": [14, 2, 0.4606, 0.0024, 2, 0.15, 0.6667, 413, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " res = util.serialize(operations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L194_C4", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "vector": [13, 2, 0.463, 0.0024, 2, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2", "label": "copy_operations", "type": "function", "loc": [196, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4714, 0.0095, 1, 0.08, 0.44, 938, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_operations", "arg_names": ["self", "other_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def copy_operations(self, other_queue):\n \"\"\"Copy the pending operations from other_queue into this one.\"\"\"\n for op in other_queue:\n self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L197_C4", "label": "expression", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2", "vector": [8, 2, 0.4702, 0.0024, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Copy the pending operations from other_queue into this one.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:For_L198_C4", "label": "for op", "type": "for", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2", "vector": [6, 2, 0.4737, 0.0048, 2, 0.58, 1.0, 316, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for op in other_queue:\n self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L199_C6", "label": "append()", "type": "expression", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:For_L198_C4", "vector": [8, 3, 0.4749, 0.0024, 3, 0.33, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "label": "new_operation", "type": "function", "loc": [201, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.4964, 0.0358, 1, 0.08, 0.48, 661, 0, 6, 1, 0, 0, 0, 3], "semantic": {"name": "new_operation", "arg_names": ["self", "method", "wave_id", "wavelet_id", "props", "kwprops"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_operation(self, method, wave_id, wavelet_id, props=None, **kwprops):\n \"\"\"Creates and adds a new operation to the operation list.\"\"\"\n if props is None:\n props = {}\n props.update(kwprops)\n props['waveId'] = wave_id\n props['waveletId'] = wavelet_id\n if self._proxy_for_id:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L202_C4", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [8, 2, 0.4821, 0.0024, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates and adds a new operation to the operation list.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L203_C4", "label": "if", "type": "if", "loc": [203, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [4, 2, 0.4857, 0.0048, 2, 0.82, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L204_C6", "label": "props =", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L203_C4", "vector": [14, 3, 0.4869, 0.0024, 3, 0.9, 0.0, 675, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L205_C4", "label": "update()", "type": "expression", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [8, 2, 0.4893, 0.0024, 2, 0.82, 0.25, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " props.update(kwprops)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L206_C4", "label": "assign", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [14, 2, 0.4916, 0.0024, 2, 0.82, 0.375, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['waveId'] = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L207_C4", "label": "assign", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [14, 2, 0.494, 0.0024, 2, 0.82, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['waveletId'] = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L208_C4", "label": "if", "type": "if", "loc": [208, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [4, 2, 0.4976, 0.0048, 2, 0.82, 0.625, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._proxy_for_id:\n props['proxyingFor'] = self._proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L209_C6", "label": "assign", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L208_C4", "vector": [14, 3, 0.4988, 0.0024, 3, 0.66, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['proxyingFor'] = self._proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L210_C4", "label": "operation = Operation()", "type": "assigned_variable", "loc": [210, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [14, 2, 0.5036, 0.0072, 2, 0.82, 0.75, 870, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "operation", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " operation = Operation(method,\n 'op%s' % OperationQueue._next_operation_id,\n props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L213_C4", "label": "append()", "type": "expression", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [8, 2, 0.5084, 0.0024, 2, 0.82, 0.875, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.__pending.append(operation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L215_C4", "label": "return", "type": "return", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "vector": [13, 2, 0.5131, 0.0024, 2, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return operation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "label": "wavelet_append_blip", "type": "function", "loc": [217, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.5346, 0.0358, 1, 0.08, 0.52, 420, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "wavelet_append_blip", "arg_names": ["self", "wave_id", "wavelet_id", "initial_content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_append_blip(self, wave_id, wavelet_id, initial_content=''):\n \"\"\"Appends a blip to a wavelet.\n\n Args:\n wave_id: The wave id owning the containing wavelet.\n wavelet_id: The wavelet id that this blip should be appended to.\n initial_content: optionally the content to start with\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L218_C4", "label": "expression", "type": "expression", "loc": [218, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "vector": [8, 2, 0.531, 0.0239, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends a blip to a wavelet.\n\n Args:\n wave_id: The wave id owning the containing wavelet.\n wavelet_id: The wavelet id that this blip should be appended to.\n initial_content: optionally the content to start with\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L228_C4", "label": "blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "vector": [14, 2, 0.5442, 0.0024, 2, 0.39, 0.3333, 892, 3, 3, 0, 0, 656, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " blip_data = self._new_blipdata(wave_id, wavelet_id, initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L229_C4", "label": "new_operation()", "type": "expression", "loc": [229, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "vector": [8, 2, 0.5477, 0.0048, 2, 0.39, 0.6667, 661, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(WAVELET_APPEND_BLIP, wave_id,\n wavelet_id, blipData=blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "vector": [13, 2, 0.5513, 0.0024, 2, 0.39, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blip_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2", "label": "wavelet_add_participant", "type": "function", "loc": [233, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.5704, 0.031, 1, 0.08, 0.56, 945, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_add_participant", "arg_names": ["self", "wave_id", "wavelet_id", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_add_participant(self, wave_id, wavelet_id, participant_id):\n \"\"\"Adds a participant to a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L234_C4", "label": "expression", "type": "expression", "loc": [234, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2", "vector": [8, 2, 0.5692, 0.0239, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Adds a participant to a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2", "vector": [13, 2, 0.5835, 0.0048, 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 self.new_operation(WAVELET_ADD_PARTICIPANT, wave_id, wavelet_id,\n participantId=participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2", "label": "wavelet_datadoc_set", "type": "function", "loc": [247, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.6038, 0.031, 1, 0.08, 0.6, 590, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": ["self", "wave_id", "wavelet_id", "name", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_datadoc_set(self, wave_id, wavelet_id, name, data):\n \"\"\"Sets a key/value pair on the data document of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n name: The key name for this data.\n data: The value of the data to set."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L248_C4", "label": "expression", "type": "expression", "loc": [248, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2", "vector": [8, 2, 0.6026, 0.0239, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets a key/value pair on the data document of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n name: The key name for this data.\n data: The value of the data to set.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2", "vector": [13, 2, 0.6169, 0.0048, 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.new_operation(WAVELET_DATADOC_SET, wave_id, wavelet_id,\n datadocName=name, datadocValue=data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "label": "robot_create_wavelet", "type": "function", "loc": [261, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.6468, 0.0501, 1, 0.08, 0.64, 952, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "robot_create_wavelet", "arg_names": ["self", "domain", "participants", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot_create_wavelet(self, domain, participants=None, message=''):\n \"\"\"Creates a new wavelet.\n\n Args:\n domain: the domain to create the wave in\n participants: initial participants on this wavelet or None if none\n message: an optional payload that is returned with the corresponding\n event."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L262_C4", "label": "expression", "type": "expression", "loc": [262, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [8, 2, 0.6372, 0.0263, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates a new wavelet.\n\n Args:\n domain: the domain to create the wave in\n participants: initial participants on this wavelet or None if none\n message: an optional payload that is returned with the corresponding\n event.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L273_C4", "label": "if", "type": "if", "loc": [273, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [4, 2, 0.6527, 0.0048, 2, 0.92, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participants is None:\n participants = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L274_C6", "label": "participants =", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L273_C4", "vector": [14, 3, 0.6539, 0.0024, 3, 0.18, 0.0, 572, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " participants = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L275_C4", "label": "blip_data, wavelet_data = _new_waveletdata()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [14, 2, 0.6563, 0.0024, 2, 0.92, 0.4, 327, 3, 2, 0, 0, 138, 10, 1], "semantic": {"name": "blip_data, wavelet_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_waveletdata", "annotation": ""}, "snippet": " blip_data, wavelet_data = self._new_waveletdata(domain, participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L276_C4", "label": "op = new_operation()", "type": "assigned_variable", "loc": [276, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [14, 2, 0.6623, 0.0095, 2, 0.92, 0.6, 316, 3, 4, 0, 0, 661, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " op = self.new_operation(ROBOT_CREATE_WAVELET,\n wave_id=wavelet_data['waveId'],\n wavelet_id=wavelet_data['waveletId'],\n waveletData=wavelet_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L280_C4", "label": "set_optional()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [8, 2, 0.6683, 0.0024, 2, 0.92, 0.8, 517, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_optional", "arg_names": [], "import_names": [], "rhs_call_name": "set_optional", "annotation": ""}, "snippet": " op.set_optional('message', message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L281_C4", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "vector": [13, 2, 0.6706, 0.0024, 2, 0.92, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blip_data, wavelet_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2", "label": "robot_fetch_wave", "type": "function", "loc": [283, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.6862, 0.0239, 1, 0.08, 0.68, 624, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "robot_fetch_wave", "arg_names": ["self", "wave_id", "wavelet_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot_fetch_wave(self, wave_id, wavelet_id):\n \"\"\"Requests a snapshot of the specified wave.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2", "vector": [8, 2, 0.6862, 0.0191, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Requests a snapshot of the specified wave.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n Returns:\n The operation created.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L292_C4", "label": "return", "type": "return", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2", "vector": [13, 2, 0.6969, 0.0024, 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.new_operation(ROBOT_FETCH_WAVE, wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2", "label": "wavelet_set_title", "type": "function", "loc": [294, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.7148, 0.0286, 1, 0.08, 0.72, 132, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_set_title", "arg_names": ["self", "wave_id", "wavelet_id", "title"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_set_title(self, wave_id, wavelet_id, title):\n \"\"\"Sets the title of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n title: The title to set.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L295_C4", "label": "expression", "type": "expression", "loc": [295, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2", "vector": [8, 2, 0.7136, 0.0215, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets the title of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n title: The title to set.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L304_C4", "label": "return", "type": "return", "loc": [304, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2", "vector": [13, 2, 0.7267, 0.0048, 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.new_operation(WAVELET_SET_TITLE, wave_id, wavelet_id,\n waveletTitle=title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2", "label": "wavelet_modify_participant_role", "type": "function", "loc": [307, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.7506, 0.0382, 1, 0.08, 0.76, 163, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_participant_role", "arg_names": ["self", "wave_id", "wavelet_id", "participant_id", "role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_modify_participant_role(\n self, wave_id, wavelet_id, participant_id, role):\n \"\"\"Modify the role of a participant on a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L309_C4", "label": "expression", "type": "expression", "loc": [309, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2", "vector": [8, 2, 0.7494, 0.0263, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Modify the role of a participant on a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n role: the new roles\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L320_C4", "label": "return", "type": "return", "loc": [320, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2", "vector": [13, 2, 0.7661, 0.0072, 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 self.new_operation(WAVELET_MODIFY_PARTICIPANT_ROLE, wave_id, \n wavelet_id, participantId=participant_id,\n participantRole=role)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2", "label": "wavelet_modify_tag", "type": "function", "loc": [324, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.79, 0.0358, 1, 0.08, 0.8, 271, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "wavelet_modify_tag", "arg_names": ["self", "wave_id", "wavelet_id", "tag", "modify_how"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_modify_tag(self, wave_id, wavelet_id, tag, modify_how=None):\n \"\"\"Modifies a tag in a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n tag: The tag (a string).\n modify_how: (optional) how to apply the tag. The default is to add"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L325_C4", "label": "expression", "type": "expression", "loc": [325, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2", "vector": [8, 2, 0.7888, 0.0286, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Modifies a tag in a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n tag: The tag (a string).\n modify_how: (optional) how to apply the tag. The default is to add\n the tag. Specify 'remove' to remove. Specify None or 'add' to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L337_C4", "label": "return", "type": "return", "loc": [337, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2", "vector": [13, 2, 0.8055, 0.0048, 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 self.new_operation(WAVELET_MODIFY_TAG, wave_id, wavelet_id,\n name=tag).set_optional(\"modify_how\", modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "label": "blip_create_child", "type": "function", "loc": [340, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.8294, 0.0382, 1, 0.08, 0.84, 643, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "blip_create_child", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_create_child(self, wave_id, wavelet_id, blip_id):\n \"\"\"Creates a child blip of another blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L341_C4", "label": "expression", "type": "expression", "loc": [341, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "vector": [8, 2, 0.8246, 0.0239, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates a child blip of another blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L351_C4", "label": "blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "vector": [14, 2, 0.8377, 0.0024, 2, 0.47, 0.3333, 892, 3, 3, 0, 0, 656, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " blip_data = self._new_blipdata(wave_id, wavelet_id, parent_blip_id=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L352_C4", "label": "new_operation()", "type": "expression", "loc": [352, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "vector": [8, 2, 0.8425, 0.0072, 2, 0.47, 0.6667, 661, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(BLIP_CREATE_CHILD, wave_id, wavelet_id,\n blipId=blip_id,\n blipData=blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L355_C4", "label": "return", "type": "return", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "vector": [13, 2, 0.8473, 0.0024, 2, 0.47, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blip_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2", "label": "blip_delete", "type": "function", "loc": [357, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.864, 0.0263, 1, 0.08, 0.88, 397, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "blip_delete", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_delete(self, wave_id, wavelet_id, blip_id):\n \"\"\"Deletes the specified blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L358_C4", "label": "expression", "type": "expression", "loc": [358, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2", "vector": [8, 2, 0.864, 0.0215, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deletes the specified blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L367_C4", "label": "return", "type": "return", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2", "vector": [13, 2, 0.8759, 0.0024, 2, 0.11, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.new_operation(BLIP_DELETE, wave_id, wavelet_id, blipId=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2", "label": "document_append_markup", "type": "function", "loc": [369, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.895, 0.031, 1, 0.08, 0.92, 684, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "document_append_markup", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id", "content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_append_markup(self, wave_id, wavelet_id, blip_id, content):\n \"\"\"Appends content with markup to a document.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n content: The markup content to append."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L370_C4", "label": "expression", "type": "expression", "loc": [370, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2", "vector": [8, 2, 0.8938, 0.0239, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends content with markup to a document.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n content: The markup content to append.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L380_C4", "label": "return", "type": "return", "loc": [380, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2", "vector": [13, 2, 0.9081, 0.0048, 2, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.new_operation(DOCUMENT_APPEND_MARKUP, wave_id, wavelet_id,\n blipId=blip_id, content=content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2", "label": "document_modify", "type": "function", "loc": [383, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.9332, 0.0406, 1, 0.08, 0.96, 155, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "document_modify", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_modify(self, wave_id, wavelet_id, blip_id):\n \"\"\"Creates and queues a document modify operation\n\n The returned operation still needs to be filled with details before\n it makes sense.\n\n Args:\n wave_id: The wave id owning that this operation is applied to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L384_C4", "label": "expression", "type": "expression", "loc": [384, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2", "vector": [8, 2, 0.9296, 0.0286, 2, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates and queues a document modify operation\n\n The returned operation still needs to be filled with details before\n it makes sense.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L396_C4", "label": "return", "type": "return", "loc": [396, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2", "vector": [13, 2, 0.9487, 0.0095, 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.new_operation(DOCUMENT_MODIFY,\n wave_id,\n wavelet_id,\n blipId=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "label": "document_inline_blip_insert", "type": "function", "loc": [401, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "vector": [2, 1, 0.9785, 0.0453, 1, 0.08, 1.0, 243, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "document_inline_blip_insert", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_inline_blip_insert(self, wave_id, wavelet_id, blip_id, position):\n \"\"\"Inserts an inline blip at a specific location.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n position: The position in the document to insert the blip."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L402_C4", "label": "expression", "type": "expression", "loc": [402, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "vector": [8, 2, 0.9714, 0.0263, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts an inline blip at a specific location.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n position: The position in the document to insert the blip.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L413_C4", "label": "inline_blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "vector": [14, 2, 0.9857, 0.0024, 2, 0.18, 0.25, 573, 3, 2, 0, 0, 656, 10, 1], "semantic": {"name": "inline_blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " inline_blip_data = self._new_blipdata(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L414_C4", "label": "assign", "type": "assigned_variable", "loc": [414, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "vector": [14, 2, 0.9881, 0.0024, 2, 0.18, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inline_blip_data['parentBlipId'] = blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L415_C4", "label": "new_operation()", "type": "expression", "loc": [415, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "vector": [8, 2, 0.994, 0.0095, 2, 0.18, 0.75, 661, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(DOCUMENT_INLINE_BLIP_INSERT, wave_id, wavelet_id,\n blipId=blip_id,\n index=position,\n blipData=inline_blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L419_C4", "label": "return", "type": "return", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "vector": [13, 2, 1.0, 0.0024, 2, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return inline_blip_data"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L165_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L165_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L168_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L184_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L184_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:For_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:For_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L199_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L204_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L209_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L233_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L247_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L274_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L383_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L402_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Assign_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1123:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1123:Return_L419_C4"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A module to run wave robots on app engine."""
import logging
import sys
import events
from google.appengine.api import urlfetch
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class CapabilitiesHandler(webapp.RequestHandler):
"""Handler to forward a request ot a handler of a robot."""
def __init__(self, method, contenttype):
"""Initializes this handler with a specific robot."""
self._method = method
self._contenttype = contenttype
def get(self):
"""Handles HTTP GET request."""
self.response.headers['Content-Type'] = self._contenttype
self.response.out.write(self._method())
class ProfileHandler(webapp.RequestHandler):
"""Handler to forward a request ot a handler of a robot."""
def __init__(self, method, contenttype):
"""Initializes this handler with a specific robot."""
self._method = method
self._contenttype = contenttype
def get(self):
"""Handles HTTP GET request."""
self.response.headers['Content-Type'] = self._contenttype
# Respond with proxied profile if name specified
if self.request.get('name'):
self.response.out.write(self._method(self.request.get('name')))
else:
self.response.out.write(self._method())
class RobotEventHandler(webapp.RequestHandler):
"""Handler for the dispatching of events to various handlers to a robot.
This handler only responds to post events with a JSON post body. Its primary
task is to separate out the context data from the events in the post body
and dispatch all events in order. Once all events have been dispatched
it serializes the context data and its associated operations as a response.
"""
def __init__(self, robot):
"""Initializes self with a specific robot."""
self._robot = robot
def get(self):
"""Handles the get event for debugging.
This is useful for debugging but since event bundles tend to be
rather big it often won't fit for more complex requests.
"""
ops = self.request.get('events')
if ops:
self.request.body = events
self.post()
def post(self):
"""Handles HTTP POST requests."""
json_body = self.request.body
if not json_body:
# TODO(davidbyttow): Log error?
return
# Redirect stdout to stderr while executing handlers. This way, any stray
# "print" statements in bot code go to the error logs instead of breaking
# the JSON response sent to the HTTP channel.
saved_stdout, sys.stdout = sys.stdout, sys.stderr
json_body = unicode(json_body, 'utf8')
logging.info('Incoming: %s', json_body)
json_response = self._robot.process_events(json_body)
logging.info('Outgoing: %s', json_response)
sys.stdout = saved_stdout
# Build the response.
self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
self.response.out.write(json_response.encode('utf-8'))
def operation_error_handler(event, wavelet):
"""Default operation error handler, logging what went wrong."""
if isinstance(event, events.OperationError):
logging.error('Previously operation failed: id=%s, message: %s',
event.operation_id, event.error_message)
def appengine_post(url, data, headers):
result = urlfetch.fetch(
method='POST',
url=url,
payload=data,
headers=headers,
deadline=10)
return result.status_code, result.content
class RobotVerifyTokenHandler(webapp.RequestHandler):
"""Handler for the token_verify request."""
def __init__(self, robot):
"""Initializes self with a specific robot."""
self._robot = robot
def get(self):
"""Handles the get event for debugging. Ops usually too long."""
token, st = self._robot.get_verification_token_info()
logging.info('token=' + token)
if token is None:
self.error(404)
self.response.out.write('No token set')
return
if not st is None:
if self.request.get('st') != st:
self.response.out.write('Invalid st value passed')
return
self.response.out.write(token)
def create_robot_webapp(robot, debug=False, extra_handlers=None):
"""Returns an instance of webapp.WSGIApplication with robot handlers."""
if not extra_handlers:
extra_handlers = []
return webapp.WSGIApplication([('.*/_wave/capabilities.xml',
lambda: CapabilitiesHandler(
robot.capabilities_xml,
'application/xml')),
('.*/_wave/robot/profile',
lambda: ProfileHandler(
robot.profile_json,
'application/json')),
('.*/_wave/robot/jsonrpc',
lambda: RobotEventHandler(robot)),
('.*/_wave/verify_token',
lambda: RobotVerifyTokenHandler(robot)),
] + extra_handlers,
debug=debug)
def run(robot, debug=False, log_errors=True, extra_handlers=None):
"""Sets up the webapp handlers for this robot and starts listening.
A robot is typically setup in the following steps:
1. Instantiate and define robot.
2. Register various handlers that it is interested in.
3. Call Run, which will setup the handlers for the app.
For example:
robot = Robot('Terminator',
image_url='http://www.sky.net/models/t800.png',
profile_url='http://www.sky.net/models/t800.html')
robot.register_handler(WAVELET_PARTICIPANTS_CHANGED, KillParticipant)
run(robot)
Args:
robot: the robot to run. This robot is modified to use app engines
urlfetch for posting http.
debug: Optional variable that defaults to False and is passed through
to the webapp application to determine if it should show debug info.
log_errors: Optional flag that defaults to True and determines whether
a default handlers to catch errors should be setup that uses the
app engine logging to log errors.
extra_handlers: Optional list of tuples that are passed to the webapp
to install more handlers. For example, passing
[('/about', AboutHandler),] would install an extra about handler
for the robot.
"""
# App Engine expects to construct a class with no arguments, so we
# pass a lambda that constructs the appropriate handler with
# arguments from the enclosing scope.
if log_errors:
robot.register_handler(events.OperationError, operation_error_handler)
robot.http_post = appengine_post
app = create_robot_webapp(robot, debug, extra_handlers)
run_wsgi_app(app)
| ajibawa-2023/Python-Code-Large/train/row_1124 | 90 | 201 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0846, 0.005, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"A module to run wave robots on app engine.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Import_L20_C0", "label": "logging import logging", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0995, 0.005, 0, 0.66, 0.0714, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Import_L21_C0", "label": "sys import sys", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1045, 0.005, 0, 0.66, 0.1429, 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_1124:Import_L23_C0", "label": "events import events", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1144, 0.005, 0, 0.66, 0.2143, 830, 0, 1, 0, 0, 830, 0, 0], "semantic": {"name": "events", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ImportFrom_L25_C0", "label": "from google.appengine.api import urlfetch", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1244, 0.005, 0, 0.66, 0.2857, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["urlfetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import urlfetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ImportFrom_L26_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1294, 0.005, 0, 0.66, 0.3571, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ImportFrom_L27_C0", "label": "from google.appengine.ext.webapp.util import run_wsgi_app", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1343, 0.005, 0, 0.66, 0.4286, 327, 0, 1, 0, 0, 327, 0, 0], "semantic": {"name": "google.appengine.ext.webapp.util", "arg_names": [], "import_names": ["run_wsgi_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp.util import run_wsgi_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "label": "CapabilitiesHandler", "type": "class", "loc": [30, 41], "level": 0, "parent": null, "vector": [3, 0, 0.1766, 0.0597, 0, 0.66, 0.5, 333, 0, 2, 0, 0, 256, 0, 2], "semantic": {"name": "CapabilitiesHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CapabilitiesHandler(webapp.RequestHandler):\n \"\"\"Handler to forward a request ot a handler of a robot.\"\"\"\n\n def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "vector": [8, 1, 0.1542, 0.005, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler to forward a request ot a handler of a robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "label": "__init__", "type": "function", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "vector": [2, 1, 0.1716, 0.0199, 1, 0.3, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "contenttype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "vector": [8, 2, 0.1692, 0.005, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this handler with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L35_C4", "label": "self._method =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "vector": [14, 2, 0.1741, 0.005, 2, 0.73, 0.5, 910, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L36_C4", "label": "self._contenttype =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "vector": [14, 2, 0.1791, 0.005, 2, 0.73, 1.0, 781, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._contenttype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "label": "get", "type": "function", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "vector": [2, 1, 0.1965, 0.0199, 1, 0.3, 1.0, 607, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles HTTP GET request.\"\"\"\n self.response.headers['Content-Type'] = self._contenttype\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "vector": [8, 2, 0.194, 0.005, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L40_C4", "label": "assign", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "vector": [14, 2, 0.199, 0.005, 2, 0.57, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = self._contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L41_C4", "label": "write()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "vector": [8, 2, 0.204, 0.005, 2, 0.57, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "label": "ProfileHandler", "type": "class", "loc": [43, 58], "level": 0, "parent": null, "vector": [3, 0, 0.2512, 0.0796, 0, 0.66, 0.5714, 173, 0, 2, 0, 0, 256, 0, 6], "semantic": {"name": "ProfileHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ProfileHandler(webapp.RequestHandler):\n \"\"\"Handler to forward a request ot a handler of a robot.\"\"\"\n\n def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L44_C2", "label": "expression", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "vector": [8, 1, 0.2189, 0.005, 1, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler to forward a request ot a handler of a robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "label": "__init__", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "vector": [2, 1, 0.2363, 0.0199, 1, 0.07, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "contenttype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "vector": [8, 2, 0.2338, 0.005, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this handler with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L48_C4", "label": "self._method =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "vector": [14, 2, 0.2388, 0.005, 2, 0.32, 0.5, 910, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L49_C4", "label": "self._contenttype =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "vector": [14, 2, 0.2438, 0.005, 2, 0.32, 1.0, 781, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._contenttype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "label": "get", "type": "function", "loc": [51, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "vector": [2, 1, 0.2711, 0.0398, 1, 0.07, 1.0, 607, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles HTTP GET request.\"\"\"\n self.response.headers['Content-Type'] = self._contenttype\n # Respond with proxied profile if name specified\n if self.request.get('name'):\n self.response.out.write(self._method(self.request.get('name')))\n else:\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L52_C4", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "vector": [8, 2, 0.2587, 0.005, 2, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L53_C4", "label": "assign", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "vector": [14, 2, 0.2637, 0.005, 2, 0.65, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = self._contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4", "label": "if", "type": "if", "loc": [55, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "vector": [4, 2, 0.2811, 0.0199, 2, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request.get('name'):\n self.response.out.write(self._method(self.request.get('name')))\n else:\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L56_C6", "label": "write()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4", "vector": [8, 3, 0.2786, 0.005, 3, 0.48, 0.0, 837, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method(self.request.get('name')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L58_C6", "label": "write()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4", "vector": [8, 3, 0.2886, 0.005, 3, 0.48, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "label": "RobotEventHandler", "type": "class", "loc": [60, 105], "level": 0, "parent": null, "vector": [3, 0, 0.4104, 0.2289, 0, 0.66, 0.6429, 528, 0, 3, 0, 0, 256, 0, 8], "semantic": {"name": "RobotEventHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RobotEventHandler(webapp.RequestHandler):\n \"\"\"Handler for the dispatching of events to various handlers to a robot.\n\n This handler only responds to post events with a JSON post body. Its primary\n task is to separate out the context data from the events in the post body\n and dispatch all events in order. Once all events have been dispatched\n it serializes the context data and its associated operations as a response.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L61_C2", "label": "expression", "type": "expression", "loc": [61, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "vector": [8, 1, 0.3184, 0.0348, 1, 0.22, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler for the dispatching of events to various handlers to a robot.\n\n This handler only responds to post events with a JSON post body. Its primary\n task is to separate out the context data from the events in the post body\n and dispatch all events in order. Once all events have been dispatched\n it serializes the context data and its associated operations as a response.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2", "label": "__init__", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "vector": [2, 1, 0.3483, 0.0149, 1, 0.22, 0.3333, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "robot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2", "vector": [8, 2, 0.3483, 0.005, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes self with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L71_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2", "vector": [14, 2, 0.3532, 0.005, 2, 0.11, 1.0, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "label": "get", "type": "function", "loc": [73, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "vector": [2, 1, 0.3856, 0.0498, 1, 0.22, 0.6667, 607, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles the get event for debugging.\n\n This is useful for debugging but since event bundles tend to be\n rather big it often won't fit for more complex requests.\n \"\"\"\n ops = self.request.get('events')\n if ops:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "vector": [8, 2, 0.3781, 0.0249, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles the get event for debugging.\n\n This is useful for debugging but since event bundles tend to be\n rather big it often won't fit for more complex requests.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L79_C4", "label": "ops = get()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "vector": [14, 2, 0.393, 0.005, 2, 0.25, 0.5, 212, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ops", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ops = self.request.get('events')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4", "label": "if", "type": "if", "loc": [80, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "vector": [4, 2, 0.403, 0.0149, 2, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ops:\n self.request.body = events\n self.post()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L81_C6", "label": "self.request.body =", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4", "vector": [14, 3, 0.403, 0.005, 3, 0.49, 0.0, 399, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request.body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request.body = events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L82_C6", "label": "post()", "type": "expression", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4", "vector": [8, 3, 0.408, 0.005, 3, 0.49, 1.0, 304, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "post", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " self.post()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "label": "post", "type": "function", "loc": [84, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "vector": [2, 1, 0.4701, 0.1095, 1, 0.22, 1.0, 304, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "post", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def post(self):\n \"\"\"Handles HTTP POST requests.\"\"\"\n json_body = self.request.body\n if not json_body:\n # TODO(davidbyttow): Log error?\n return\n\n # Redirect stdout to stderr while executing handlers. This way, any stray"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L85_C4", "label": "expression", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [8, 2, 0.4229, 0.005, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP POST requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L86_C4", "label": "json_body =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.4279, 0.005, 2, 0.15, 0.1, 958, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json_body = self.request.body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L87_C4", "label": "if", "type": "if", "loc": [87, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [4, 2, 0.4378, 0.0149, 2, 0.15, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not json_body:\n # TODO(davidbyttow): Log error?\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L89_C6", "label": "return", "type": "return", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L87_C4", "vector": [13, 3, 0.4428, 0.005, 3, 0.25, 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_1124:Assign_L94_C4", "label": "saved_stdout =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.4677, 0.005, 2, 0.15, 0.3, 826, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "saved_stdout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_stdout, sys.stdout = sys.stdout, sys.stderr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L96_C4", "label": "json_body = unicode()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.4776, 0.005, 2, 0.15, 0.4, 958, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " json_body = unicode(json_body, 'utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L97_C4", "label": "info()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [8, 2, 0.4826, 0.005, 2, 0.15, 0.5, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('Incoming: %s', json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L98_C4", "label": "json_response = process_events()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.4876, 0.005, 2, 0.15, 0.6, 870, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json_response", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json_response = self._robot.process_events(json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L99_C4", "label": "info()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [8, 2, 0.4925, 0.005, 2, 0.15, 0.7, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('Outgoing: %s', json_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L101_C4", "label": "sys.stdout =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.5025, 0.005, 2, 0.15, 0.8, 260, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.stdout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.stdout = saved_stdout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L104_C4", "label": "assign", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [14, 2, 0.5174, 0.005, 2, 0.15, 0.9, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = 'application/json; charset=utf-8'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L105_C4", "label": "write()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "vector": [8, 2, 0.5224, 0.005, 2, 0.15, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(json_response.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L108_C0", "label": "operation_error_handler", "type": "function", "loc": [108, 112], "level": 0, "parent": null, "vector": [2, 0, 0.5473, 0.0249, 0, 0.66, 0.7143, 332, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "operation_error_handler", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def operation_error_handler(event, wavelet):\n \"\"\"Default operation error handler, logging what went wrong.\"\"\"\n if isinstance(event, events.OperationError):\n logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L108_C0", "vector": [8, 1, 0.5423, 0.005, 1, 0.08, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Default operation error handler, logging what went wrong.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L110_C2", "label": "if", "type": "if", "loc": [110, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L108_C0", "vector": [4, 1, 0.5522, 0.0149, 1, 0.08, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(event, events.OperationError):\n logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L111_C4", "label": "error()", "type": "expression", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L110_C2", "vector": [8, 2, 0.5547, 0.01, 2, 0.46, 0.0, 771, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L115_C0", "label": "appengine_post", "type": "function", "loc": [115, 122], "level": 0, "parent": null, "vector": [2, 0, 0.5896, 0.0398, 0, 0.66, 0.7857, 418, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "appengine_post", "arg_names": ["url", "data", "headers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def appengine_post(url, data, headers):\n result = urlfetch.fetch(\n method='POST',\n url=url,\n payload=data,\n headers=headers,\n deadline=10)\n return result.status_code, result.content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L116_C2", "label": "result = fetch()", "type": "assigned_variable", "loc": [116, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L115_C0", "vector": [14, 1, 0.5896, 0.0299, 1, 0.5, 0.0, 51, 3, 5, 0, 0, 587, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " result = urlfetch.fetch(\n method='POST',\n url=url,\n payload=data,\n headers=headers,\n deadline=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L122_C2", "label": "return", "type": "return", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L115_C0", "vector": [13, 1, 0.607, 0.005, 1, 0.5, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result.status_code, result.content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "label": "RobotVerifyTokenHandler", "type": "class", "loc": [125, 144], "level": 0, "parent": null, "vector": [3, 0, 0.6692, 0.0995, 0, 0.66, 0.8571, 703, 0, 2, 0, 0, 256, 0, 7], "semantic": {"name": "RobotVerifyTokenHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RobotVerifyTokenHandler(webapp.RequestHandler):\n \"\"\"Handler for the token_verify request.\"\"\"\n\n def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot\n\n def get(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L126_C2", "label": "expression", "type": "expression", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "vector": [8, 1, 0.6269, 0.005, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler for the token_verify request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2", "label": "__init__", "type": "function", "loc": [128, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "vector": [2, 1, 0.6418, 0.0149, 1, 0.7, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "robot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L129_C4", "label": "expression", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2", "vector": [8, 2, 0.6418, 0.005, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes self with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L130_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2", "vector": [14, 2, 0.6468, 0.005, 2, 0.66, 1.0, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "label": "get", "type": "function", "loc": [132, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "vector": [2, 1, 0.6866, 0.0647, 1, 0.7, 1.0, 607, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles the get event for debugging. Ops usually too long.\"\"\"\n token, st = self._robot.get_verification_token_info()\n logging.info('token=' + token)\n if token is None:\n self.error(404)\n self.response.out.write('No token set')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L133_C4", "label": "expression", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [8, 2, 0.6617, 0.005, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles the get event for debugging. Ops usually too long.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L134_C4", "label": "token, st = get_verification_token_info()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [14, 2, 0.6667, 0.005, 2, 0.07, 0.2, 520, 3, 0, 0, 0, 510, 10, 1], "semantic": {"name": "token, st", "arg_names": [], "import_names": [], "rhs_call_name": "get_verification_token_info", "annotation": ""}, "snippet": " token, st = self._robot.get_verification_token_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L135_C4", "label": "info()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [8, 2, 0.6716, 0.005, 2, 0.07, 0.4, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('token=' + token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "label": "if", "type": "if", "loc": [136, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [4, 2, 0.6841, 0.0199, 2, 0.07, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token is None:\n self.error(404)\n self.response.out.write('No token set')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L137_C6", "label": "error()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "vector": [8, 3, 0.6816, 0.005, 3, 0.63, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.error(404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L138_C6", "label": "write()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "vector": [8, 3, 0.6866, 0.005, 3, 0.63, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write('No token set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L139_C6", "label": "return", "type": "return", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "vector": [13, 3, 0.6915, 0.005, 3, 0.63, 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_1124:If_L140_C4", "label": "if", "type": "if", "loc": [140, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [4, 2, 0.704, 0.0199, 2, 0.07, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not st is None:\n if self.request.get('st') != st:\n self.response.out.write('Invalid st value passed')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6", "label": "if", "type": "if", "loc": [141, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L140_C4", "vector": [4, 3, 0.7065, 0.0149, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request.get('st') != st:\n self.response.out.write('Invalid st value passed')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L142_C8", "label": "write()", "type": "expression", "loc": [142, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6", "vector": [8, 4, 0.7065, 0.005, 4, 0.45, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write('Invalid st value passed')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6", "vector": [13, 4, 0.7114, 0.005, 4, 0.45, 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_1124:Expr_L144_C4", "label": "write()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "vector": [8, 2, 0.7164, 0.005, 2, 0.07, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "label": "create_robot_webapp", "type": "function", "loc": [147, 164], "level": 0, "parent": null, "vector": [2, 0, 0.7736, 0.0896, 0, 0.66, 0.9286, 128, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "create_robot_webapp", "arg_names": ["robot", "debug", "extra_handlers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_robot_webapp(robot, debug=False, extra_handlers=None):\n \"\"\"Returns an instance of webapp.WSGIApplication with robot handlers.\"\"\"\n if not extra_handlers:\n extra_handlers = []\n return webapp.WSGIApplication([('.*/_wave/capabilities.xml',\n lambda: CapabilitiesHandler(\n robot.capabilities_xml,\n 'application/xml')),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L148_C2", "label": "expression", "type": "expression", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "vector": [8, 1, 0.7363, 0.005, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns an instance of webapp.WSGIApplication with robot handlers.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L149_C2", "label": "if", "type": "if", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "vector": [4, 1, 0.7438, 0.01, 1, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not extra_handlers:\n extra_handlers = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L150_C4", "label": "extra_handlers =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L149_C2", "vector": [14, 2, 0.7463, 0.005, 2, 0.2, 0.0, 379, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extra_handlers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_handlers = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L151_C2", "label": "return", "type": "return", "loc": [151, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "vector": [13, 1, 0.7836, 0.0697, 1, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return webapp.WSGIApplication([('.*/_wave/capabilities.xml',\n lambda: CapabilitiesHandler(\n robot.capabilities_xml,\n 'application/xml')),\n ('.*/_wave/robot/profile',\n lambda: ProfileHandler(\n robot.profile_json,\n 'application/json')),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "label": "run", "type": "function", "loc": [167, 201], "level": 0, "parent": null, "vector": [2, 0, 0.9154, 0.1741, 0, 0.66, 1.0, 679, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": ["robot", "debug", "log_errors", "extra_handlers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(robot, debug=False, log_errors=True, extra_handlers=None):\n \"\"\"Sets up the webapp handlers for this robot and starts listening.\n\n A robot is typically setup in the following steps:\n 1. Instantiate and define robot.\n 2. Register various handlers that it is interested in.\n 3. Call Run, which will setup the handlers for the app.\n For example:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L168_C2", "label": "expression", "type": "expression", "loc": [168, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "vector": [8, 1, 0.898, 0.1294, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets up the webapp handlers for this robot and starts listening.\n\n A robot is typically setup in the following steps:\n 1. Instantiate and define robot.\n 2. Register various handlers that it is interested in.\n 3. Call Run, which will setup the handlers for the app.\n For example:\n robot = Robot('Terminator',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L197_C2", "label": "if", "type": "if", "loc": [197, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "vector": [4, 1, 0.9826, 0.01, 1, 0.65, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if log_errors:\n robot.register_handler(events.OperationError, operation_error_handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L198_C4", "label": "register_handler()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L197_C2", "vector": [8, 2, 0.9851, 0.005, 2, 0.3, 0.0, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.OperationError, operation_error_handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L199_C2", "label": "robot.http_post =", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "vector": [14, 1, 0.99, 0.005, 1, 0.65, 0.5, 986, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "robot.http_post", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " robot.http_post = appengine_post"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L200_C2", "label": "app = create_robot_webapp()", "type": "assigned_variable", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "vector": [14, 1, 0.995, 0.005, 1, 0.65, 0.75, 494, 3, 3, 0, 0, 128, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "create_robot_webapp", "annotation": ""}, "snippet": " app = create_robot_webapp(robot, debug, extra_handlers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L201_C2", "label": "run_wsgi_app()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "vector": [8, 1, 1.0, 0.005, 1, 0.65, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " run_wsgi_app(app)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L89_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L110_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L110_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L137_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L138_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L139_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L141_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L148_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L149_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L149_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Return_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L197_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:If_L197_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Assign_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1124:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1124:Expr_L201_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the ops module."""
import unittest
import ops
class TestOperation(unittest.TestCase):
"""Test case for Operation class."""
def testFields(self):
op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',
{'waveId': 'wavelet-id',
'title': 'a title'})
self.assertEqual(ops.WAVELET_SET_TITLE, op.method)
self.assertEqual('opid02', op.id)
self.assertEqual(2, len(op.params))
def testConstructModifyTag(self):
q = ops.OperationQueue()
op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')
self.assertEqual(3, len(op.params))
op = q.wavelet_modify_tag(
'waveid', 'waveletid', 'tag', modify_how='remove')
self.assertEqual(4, len(op.params))
def testConstructRobotFetchWave(self):
q = ops.OperationQueue('proxyid')
op = q.robot_fetch_wave('wave1', 'wavelet1')
self.assertEqual(3, len(op.params))
self.assertEqual('proxyid', op.params['proxyingFor'])
self.assertEqual('wave1', op.params['waveId'])
self.assertEqual('wavelet1', op.params['waveletId'])
class TestOperationQueue(unittest.TestCase):
"""Test case for OperationQueue class."""
def testSerialize(self):
q = ops.OperationQueue()
q.set_capability_hash('hash')
op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')
json = q.serialize()
self.assertEqual(2, len(json))
self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])
self.assertEqual('hash', json[0]['params']['capabilitiesHash'])
self.assertEqual(ops.PROTOCOL_VERSION, json[0]['params']['protocolVersion'])
self.assertEqual('wavelet.modifyTag', json[1]['method'])
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1125 | 37 | 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_1125:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2537, 0.0149, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the ops module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2985, 0.0149, 0, 0.66, 0.2, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Import_L22_C0", "label": "ops import ops", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.3284, 0.0149, 0, 0.66, 0.4, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "label": "TestOperation", "type": "class", "loc": [25, 50], "level": 0, "parent": null, "vector": [3, 0, 0.5597, 0.3881, 0, 0.66, 0.6, 303, 0, 3, 0, 0, 878, 0, 19], "semantic": {"name": "TestOperation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestOperation(unittest.TestCase):\n \"\"\"Test case for Operation class.\"\"\"\n\n def testFields(self):\n op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})\n self.assertEqual(ops.WAVELET_SET_TITLE, op.method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L26_C2", "label": "expression", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "vector": [8, 1, 0.3881, 0.0149, 1, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Test case for Operation class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "label": "testFields", "type": "function", "loc": [28, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "vector": [2, 1, 0.4627, 0.1045, 1, 0.52, 0.3333, 759, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testFields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFields(self):\n op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})\n self.assertEqual(ops.WAVELET_SET_TITLE, op.method)\n self.assertEqual('opid02', op.id)\n self.assertEqual(2, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L29_C4", "label": "op = Operation()", "type": "assigned_variable", "loc": [29, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "vector": [14, 2, 0.4478, 0.0448, 2, 0.06, 0.0, 316, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L32_C4", "label": "assertEqual()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "vector": [8, 2, 0.4776, 0.0149, 2, 0.06, 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(ops.WAVELET_SET_TITLE, op.method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L33_C4", "label": "assertEqual()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "vector": [8, 2, 0.4925, 0.0149, 2, 0.06, 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('opid02', op.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L34_C4", "label": "assertEqual()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "vector": [8, 2, 0.5075, 0.0149, 2, 0.06, 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(2, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "label": "testConstructModifyTag", "type": "function", "loc": [36, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "vector": [2, 1, 0.5821, 0.1045, 1, 0.52, 0.6667, 596, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testConstructModifyTag", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConstructModifyTag(self):\n q = ops.OperationQueue()\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n self.assertEqual(3, len(op.params))\n op = q.wavelet_modify_tag(\n 'waveid', 'waveletid', 'tag', modify_how='remove')\n self.assertEqual(4, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L37_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "vector": [14, 2, 0.5522, 0.0149, 2, 0.13, 0.0, 516, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L38_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "vector": [14, 2, 0.5672, 0.0149, 2, 0.13, 0.25, 316, 3, 3, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L39_C4", "label": "assertEqual()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "vector": [8, 2, 0.5821, 0.0149, 2, 0.13, 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(3, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L40_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "vector": [14, 2, 0.6045, 0.0299, 2, 0.13, 0.75, 316, 3, 4, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag(\n 'waveid', 'waveletid', 'tag', modify_how='remove')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L42_C4", "label": "assertEqual()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "vector": [8, 2, 0.6269, 0.0149, 2, 0.13, 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(4, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "label": "testConstructRobotFetchWave", "type": "function", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "vector": [2, 1, 0.7015, 0.1045, 1, 0.52, 1.0, 750, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testConstructRobotFetchWave", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConstructRobotFetchWave(self):\n q = ops.OperationQueue('proxyid')\n op = q.robot_fetch_wave('wave1', 'wavelet1')\n self.assertEqual(3, len(op.params))\n self.assertEqual('proxyid', op.params['proxyingFor'])\n self.assertEqual('wave1', op.params['waveId'])\n self.assertEqual('wavelet1', op.params['waveletId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L45_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [14, 2, 0.6716, 0.0149, 2, 0.92, 0.0, 516, 3, 1, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue('proxyid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L46_C4", "label": "op = robot_fetch_wave()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [14, 2, 0.6866, 0.0149, 2, 0.92, 0.2, 316, 3, 2, 0, 0, 624, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "robot_fetch_wave", "annotation": ""}, "snippet": " op = q.robot_fetch_wave('wave1', 'wavelet1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L47_C4", "label": "assertEqual()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [8, 2, 0.7015, 0.0149, 2, 0.92, 0.4, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(3, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L48_C4", "label": "assertEqual()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [8, 2, 0.7164, 0.0149, 2, 0.92, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('proxyid', op.params['proxyingFor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L49_C4", "label": "assertEqual()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [8, 2, 0.7313, 0.0149, 2, 0.92, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wave1', op.params['waveId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L50_C4", "label": "assertEqual()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "vector": [8, 2, 0.7463, 0.0149, 2, 0.92, 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('wavelet1', op.params['waveletId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L52_C0", "label": "TestOperationQueue", "type": "class", "loc": [52, 64], "level": 0, "parent": null, "vector": [3, 0, 0.8657, 0.194, 0, 0.66, 0.8, 241, 0, 1, 0, 0, 878, 0, 10], "semantic": {"name": "TestOperationQueue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestOperationQueue(unittest.TestCase):\n \"\"\"Test case for OperationQueue class.\"\"\"\n\n def testSerialize(self):\n q = ops.OperationQueue()\n q.set_capability_hash('hash')\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n json = q.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L53_C2", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L52_C0", "vector": [8, 1, 0.791, 0.0149, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Test case for OperationQueue class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "label": "testSerialize", "type": "function", "loc": [55, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L52_C0", "vector": [2, 1, 0.8881, 0.1493, 1, 0.8, 1.0, 465, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n q = ops.OperationQueue()\n q.set_capability_hash('hash')\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n json = q.serialize()\n self.assertEqual(2, len(json))\n self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])\n self.assertEqual('hash', json[0]['params']['capabilitiesHash'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L56_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [14, 2, 0.8358, 0.0149, 2, 0.99, 0.0, 516, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L57_C4", "label": "set_capability_hash()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.8507, 0.0149, 2, 0.99, 0.125, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "set_capability_hash", "annotation": ""}, "snippet": " q.set_capability_hash('hash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L58_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [14, 2, 0.8657, 0.0149, 2, 0.99, 0.25, 316, 3, 3, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L59_C4", "label": "json = serialize()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [14, 2, 0.8806, 0.0149, 2, 0.99, 0.375, 463, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " json = q.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L60_C4", "label": "assertEqual()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.8955, 0.0149, 2, 0.99, 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(2, len(json))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L61_C4", "label": "assertEqual()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.9104, 0.0149, 2, 0.99, 0.625, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L62_C4", "label": "assertEqual()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.9254, 0.0149, 2, 0.99, 0.75, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('hash', json[0]['params']['capabilitiesHash'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L63_C4", "label": "assertEqual()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.9403, 0.0149, 2, 0.99, 0.875, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ops.PROTOCOL_VERSION, json[0]['params']['protocolVersion'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L64_C4", "label": "assertEqual()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "vector": [8, 2, 0.9552, 0.0149, 2, 0.99, 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('wavelet.modifyTag', json[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:If_L66_C0", "label": "if", "type": "if", "loc": [66, 67], "level": 0, "parent": null, "vector": [4, 0, 0.9925, 0.0299, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L67_C2", "label": "main()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1125:If_L66_C0", "vector": [8, 1, 1.0, 0.0149, 1, 0.52, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1125:If_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1125:Expr_L67_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility library containing various helpers used by the API."""
import re
CUSTOM_SERIALIZE_METHOD_NAME = 'serialize'
MARKUP_RE = re.compile(r'<([^>]*?)>')
def force_unicode(object):
""" Return the Unicode string version of object, with UTF-8 encoding. """
if isinstance(object, unicode):
return object
return unicode(str(object), 'utf-8')
def parse_markup(markup):
"""Parses a bit of markup into robot compatible text.
For now this is a rough approximation.
"""
def replace_tag(group):
if not group.groups:
return ''
tag = group.groups()[0].split(' ', 1)[0]
if (tag == 'p' or tag == 'br'):
return '\n'
return ''
return MARKUP_RE.sub(replace_tag, markup)
def is_iterable(inst):
"""Returns whether or not this is a list, tuple, set or dict .
Note that this does not return true for strings.
"""
return hasattr(inst, '__iter__')
def is_dict(inst):
"""Returns whether or not the specified instance is a dict."""
return hasattr(inst, 'iteritems')
def is_user_defined_new_style_class(obj):
"""Returns whether or not the specified instance is a user-defined type."""
return type(obj).__module__ != '__builtin__'
def lower_camel_case(s):
"""Converts a string to lower camel case.
Examples:
foo => foo
foo_bar => fooBar
foo__bar => fooBar
foo_bar_baz => fooBarBaz
Args:
s: The string to convert to lower camel case.
Returns:
The lower camel cased string.
"""
return reduce(lambda a, b: a + (a and b.capitalize() or b), s.split('_'))
def non_none_dict(d):
"""return a copy of the dictionary without none values."""
return dict([a for a in d.items() if not a[1] is None])
def _serialize_attributes(obj):
"""Serializes attributes of an instance.
Iterates all attributes of an object and invokes serialize if they are
public and not callable.
Args:
obj: The instance to serialize.
Returns:
The serialized object.
"""
data = {}
for attr_name in dir(obj):
if attr_name.startswith('_'):
continue
attr = getattr(obj, attr_name)
if attr is None or callable(attr):
continue
# Looks okay, serialize it.
data[lower_camel_case(attr_name)] = serialize(attr)
return data
def _serialize_dict(d):
"""Invokes serialize on all of its key/value pairs.
Args:
d: The dict instance to serialize.
Returns:
The serialized dict.
"""
data = {}
for k, v in d.items():
data[lower_camel_case(k)] = serialize(v)
return data
def serialize(obj):
"""Serializes any instance.
If this is a user-defined instance
type, it will first check for a custom Serialize() function and use that
if it exists. Otherwise, it will invoke serialize all of its public
attributes. Lists and dicts are serialized trivially.
Args:
obj: The instance to serialize.
Returns:
The serialized object.
"""
if is_user_defined_new_style_class(obj):
if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):
method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)
if callable(method):
return method()
return _serialize_attributes(obj)
elif is_dict(obj):
return _serialize_dict(obj)
elif is_iterable(obj):
return [serialize(v) for v in obj]
return obj
class StringEnum(object):
"""Enum like class that is configured with a list of values.
This class effectively implements an enum for Elements, except for that
the actual values of the enums will be the string values.
"""
def __init__(self, *values):
for name in values:
setattr(self, name, name)
| ajibawa-2023/Python-Code-Large/train/row_1126 | 67 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1069, 0.0063, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Utility library containing various helpers used by the API.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Import_L19_C0", "label": "re import re", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1195, 0.0063, 0, 0.66, 0.0714, 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_1126:Assign_L21_C0", "label": "CUSTOM_SERIALIZE_METHOD_NAME =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1321, 0.0063, 0, 0.66, 0.1429, 6, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CUSTOM_SERIALIZE_METHOD_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CUSTOM_SERIALIZE_METHOD_NAME = 'serialize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L23_C0", "label": "MARKUP_RE = compile()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1447, 0.0063, 0, 0.66, 0.2143, 885, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "MARKUP_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "MARKUP_RE = re.compile(r'<([^>]*?)>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "label": "force_unicode", "type": "function", "loc": [26, 30], "level": 0, "parent": null, "vector": [2, 0, 0.1761, 0.0314, 0, 0.66, 0.2857, 870, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "force_unicode", "arg_names": ["object"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def force_unicode(object):\n \"\"\" Return the Unicode string version of object, with UTF-8 encoding. \"\"\"\n if isinstance(object, unicode):\n return object\n return unicode(str(object), 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "vector": [8, 1, 0.1698, 0.0063, 1, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Return the Unicode string version of object, with UTF-8 encoding. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L28_C2", "label": "if", "type": "if", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "vector": [4, 1, 0.1792, 0.0126, 1, 0.72, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(object, unicode):\n return object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L28_C2", "vector": [13, 2, 0.1824, 0.0063, 2, 0.75, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L30_C2", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "vector": [13, 1, 0.1887, 0.0063, 1, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(str(object), 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "label": "parse_markup", "type": "function", "loc": [32, 45], "level": 0, "parent": null, "vector": [2, 0, 0.2421, 0.0881, 0, 0.66, 0.3571, 378, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "parse_markup", "arg_names": ["markup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_markup(markup):\n \"\"\"Parses a bit of markup into robot compatible text.\n \n For now this is a rough approximation.\n \"\"\"\n def replace_tag(group):\n if not group.groups:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L33_C2", "label": "expression", "type": "expression", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "vector": [8, 1, 0.217, 0.0252, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a bit of markup into robot compatible text.\n \n For now this is a rough approximation.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "label": "replace_tag", "type": "function", "loc": [37, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "vector": [2, 1, 0.2516, 0.044, 1, 0.57, 0.5, 444, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace_tag", "arg_names": ["group"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace_tag(group):\n if not group.groups:\n return ''\n tag = group.groups()[0].split(' ', 1)[0]\n if (tag == 'p' or tag == 'br'):\n return '\\n'\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L38_C4", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "vector": [4, 2, 0.2421, 0.0126, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not group.groups:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L39_C6", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L38_C4", "vector": [13, 3, 0.2453, 0.0063, 3, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L40_C4", "label": "tag =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "vector": [14, 2, 0.2516, 0.0063, 2, 0.93, 0.3333, 732, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = group.groups()[0].split(' ', 1)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "vector": [4, 2, 0.261, 0.0126, 2, 0.93, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (tag == 'p' or tag == 'br'):\n return '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L42_C6", "label": "return", "type": "return", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L41_C4", "vector": [13, 3, 0.2642, 0.0063, 3, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "vector": [13, 2, 0.2704, 0.0063, 2, 0.93, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "vector": [13, 1, 0.283, 0.0063, 1, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return MARKUP_RE.sub(replace_tag, markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L47_C0", "label": "is_iterable", "type": "function", "loc": [47, 52], "level": 0, "parent": null, "vector": [2, 0, 0.3113, 0.0377, 0, 0.66, 0.4286, 258, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_iterable", "arg_names": ["inst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_iterable(inst):\n \"\"\"Returns whether or not this is a list, tuple, set or dict .\n\n Note that this does not return true for strings.\n \"\"\"\n return hasattr(inst, '__iter__')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L48_C2", "label": "expression", "type": "expression", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L47_C0", "vector": [8, 1, 0.3113, 0.0252, 1, 0.93, 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 this is a list, tuple, set or dict .\n\n Note that this does not return true for strings.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L52_C2", "label": "return", "type": "return", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L47_C0", "vector": [13, 1, 0.327, 0.0063, 1, 0.93, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hasattr(inst, '__iter__')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L54_C0", "label": "is_dict", "type": "function", "loc": [54, 56], "level": 0, "parent": null, "vector": [2, 0, 0.3459, 0.0189, 0, 0.66, 0.5, 59, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_dict", "arg_names": ["inst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_dict(inst):\n \"\"\"Returns whether or not the specified instance is a dict.\"\"\"\n return hasattr(inst, 'iteritems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L54_C0", "vector": [8, 1, 0.3459, 0.0063, 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 whether or not the specified instance is a dict.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L54_C0", "vector": [13, 1, 0.3522, 0.0063, 1, 0.07, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hasattr(inst, 'iteritems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L59_C0", "label": "is_user_defined_new_style_class", "type": "function", "loc": [59, 61], "level": 0, "parent": null, "vector": [2, 0, 0.3774, 0.0189, 0, 0.66, 0.5714, 657, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_user_defined_new_style_class", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_user_defined_new_style_class(obj):\n \"\"\"Returns whether or not the specified instance is a user-defined type.\"\"\"\n return type(obj).__module__ != '__builtin__'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L59_C0", "vector": [8, 1, 0.3774, 0.0063, 1, 0.0, 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 specified instance is a user-defined type.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L61_C2", "label": "return", "type": "return", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L59_C0", "vector": [13, 1, 0.3836, 0.0063, 1, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(obj).__module__ != '__builtin__'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L63_C0", "label": "lower_camel_case", "type": "function", "loc": [63, 78], "level": 0, "parent": null, "vector": [2, 0, 0.4434, 0.1006, 0, 0.66, 0.6429, 841, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "lower_camel_case", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def lower_camel_case(s):\n \"\"\"Converts a string to lower camel case.\n\n Examples:\n foo => foo\n foo_bar => fooBar\n foo__bar => fooBar\n foo_bar_baz => fooBarBaz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L64_C2", "label": "expression", "type": "expression", "loc": [64, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L63_C0", "vector": [8, 1, 0.4434, 0.0881, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Converts a string to lower camel case.\n\n Examples:\n foo => foo\n foo_bar => fooBar\n foo__bar => fooBar\n foo_bar_baz => fooBarBaz\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L63_C0", "vector": [13, 1, 0.4906, 0.0063, 1, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reduce(lambda a, b: a + (a and b.capitalize() or b), s.split('_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L80_C0", "label": "non_none_dict", "type": "function", "loc": [80, 82], "level": 0, "parent": null, "vector": [2, 0, 0.5094, 0.0189, 0, 0.66, 0.7143, 666, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "non_none_dict", "arg_names": ["d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def non_none_dict(d):\n \"\"\"return a copy of the dictionary without none values.\"\"\"\n return dict([a for a in d.items() if not a[1] is None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L81_C2", "label": "expression", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L80_C0", "vector": [8, 1, 0.5094, 0.0063, 1, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"return a copy of the dictionary without none values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L80_C0", "vector": [13, 1, 0.5157, 0.0063, 1, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict([a for a in d.items() if not a[1] is None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "label": "_serialize_attributes", "type": "function", "loc": [84, 105], "level": 0, "parent": null, "vector": [2, 0, 0.5943, 0.1384, 0, 0.66, 0.7857, 227, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_serialize_attributes", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _serialize_attributes(obj):\n \"\"\"Serializes attributes of an instance.\n\n Iterates all attributes of an object and invokes serialize if they are\n public and not callable.\n\n Args:\n obj: The instance to serialize."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "vector": [8, 1, 0.566, 0.0692, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes attributes of an instance.\n\n Iterates all attributes of an object and invokes serialize if they are\n public and not callable.\n\n Args:\n obj: The instance to serialize.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L96_C2", "label": "data =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "vector": [14, 1, 0.6038, 0.0063, 1, 0.46, 0.3333, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "label": "for attr_name", "type": "for", "loc": [97, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "vector": [6, 1, 0.6321, 0.0503, 1, 0.46, 0.6667, 722, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "attr_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for attr_name in dir(obj):\n if attr_name.startswith('_'):\n continue\n attr = getattr(obj, attr_name)\n if attr is None or callable(attr):\n continue\n # Looks okay, serialize it.\n data[lower_camel_case(attr_name)] = serialize(attr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L98_C4", "label": "if", "type": "if", "loc": [98, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "vector": [4, 2, 0.6195, 0.0126, 2, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attr_name.startswith('_'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L100_C4", "label": "attr = getattr()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "vector": [14, 2, 0.6289, 0.0063, 2, 0.22, 0.3333, 400, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " attr = getattr(obj, attr_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L101_C4", "label": "if", "type": "if", "loc": [101, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "vector": [4, 2, 0.6384, 0.0126, 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 attr is None or callable(attr):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L104_C4", "label": " = serialize()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "vector": [14, 2, 0.6541, 0.0063, 2, 0.22, 1.0, 0, 3, 1, 0, 0, 50, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " data[lower_camel_case(attr_name)] = serialize(attr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L105_C2", "label": "return", "type": "return", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "vector": [13, 1, 0.6604, 0.0063, 1, 0.46, 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_1126:FunctionDef_L108_C0", "label": "_serialize_dict", "type": "function", "loc": [108, 120], "level": 0, "parent": null, "vector": [2, 0, 0.717, 0.0818, 0, 0.66, 0.8571, 134, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_serialize_dict", "arg_names": ["d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _serialize_dict(d):\n \"\"\"Invokes serialize on all of its key/value pairs.\n\n Args:\n d: The dict instance to serialize.\n\n Returns:\n The serialized dict."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "vector": [8, 1, 0.7075, 0.0503, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Invokes serialize on all of its key/value pairs.\n\n Args:\n d: The dict instance to serialize.\n\n Returns:\n The serialized dict.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L117_C2", "label": "data =", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "vector": [14, 1, 0.7358, 0.0063, 1, 0.23, 0.3333, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L118_C2", "label": "for k, v", "type": "for", "loc": [118, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "vector": [6, 1, 0.7453, 0.0126, 1, 0.23, 0.6667, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in d.items():\n data[lower_camel_case(k)] = serialize(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L119_C4", "label": " = serialize()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L118_C2", "vector": [14, 2, 0.7484, 0.0063, 2, 0.13, 0.0, 0, 3, 1, 0, 0, 50, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " data[lower_camel_case(k)] = serialize(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L120_C2", "label": "return", "type": "return", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "vector": [13, 1, 0.7547, 0.0063, 1, 0.23, 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_1126:FunctionDef_L123_C0", "label": "serialize", "type": "function", "loc": [123, 147], "level": 0, "parent": null, "vector": [2, 0, 0.8491, 0.1572, 0, 0.66, 0.9286, 50, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "serialize", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def serialize(obj):\n \"\"\"Serializes any instance.\n\n If this is a user-defined instance\n type, it will first check for a custom Serialize() function and use that\n if it exists. Otherwise, it will invoke serialize all of its public\n attributes. Lists and dicts are serialized trivially.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L124_C2", "label": "expression", "type": "expression", "loc": [124, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "vector": [8, 1, 0.8176, 0.0818, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes any instance.\n\n If this is a user-defined instance\n type, it will first check for a custom Serialize() function and use that\n if it exists. Otherwise, it will invoke serialize all of its public\n attributes. Lists and dicts are serialized trivially.\n\n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "label": "if", "type": "if", "loc": [137, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "vector": [4, 1, 0.8899, 0.0629, 1, 0.46, 0.5, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_user_defined_new_style_class(obj):\n if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):\n method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)\n if callable(method):\n return method()\n return _serialize_attributes(obj)\n elif is_dict(obj):\n return _serialize_dict(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4", "label": "if", "type": "if", "loc": [138, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "vector": [4, 2, 0.8774, 0.0252, 2, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):\n method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)\n if callable(method):\n return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L139_C6", "label": "method = getattr()", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4", "vector": [14, 3, 0.8742, 0.0063, 3, 0.62, 0.0, 445, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "method", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L140_C6", "label": "if", "type": "if", "loc": [140, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4", "vector": [4, 3, 0.8836, 0.0126, 3, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(method):\n return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L140_C6", "vector": [13, 4, 0.8868, 0.0063, 4, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L142_C4", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "vector": [13, 2, 0.8931, 0.0063, 2, 0.95, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _serialize_attributes(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2", "label": "if", "type": "if", "loc": [143, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "vector": [4, 2, 0.9088, 0.0252, 2, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif is_dict(obj):\n return _serialize_dict(obj)\n elif is_iterable(obj):\n return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L144_C4", "label": "return", "type": "return", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2", "vector": [13, 3, 0.9057, 0.0063, 3, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _serialize_dict(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L145_C2", "label": "if", "type": "if", "loc": [145, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2", "vector": [4, 3, 0.9151, 0.0126, 3, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif is_iterable(obj):\n return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L146_C4", "label": "return", "type": "return", "loc": [146, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L145_C2", "vector": [13, 4, 0.9182, 0.0063, 4, 0.1, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L147_C2", "label": "return", "type": "return", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "vector": [13, 1, 0.9245, 0.0063, 1, 0.46, 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_1126:ClassDef_L150_C0", "label": "StringEnum", "type": "class", "loc": [150, 159], "level": 0, "parent": null, "vector": [3, 0, 0.9717, 0.0629, 0, 0.66, 1.0, 716, 0, 1, 0, 0, 186, 0, 1], "semantic": {"name": "StringEnum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StringEnum(object):\n \"\"\"Enum like class that is configured with a list of values.\n\n This class effectively implements an enum for Elements, except for that\n the actual values of the enums will be the string values.\n \"\"\"\n\n def __init__(self, *values):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L151_C2", "label": "expression", "type": "expression", "loc": [151, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:ClassDef_L150_C0", "vector": [8, 1, 0.9623, 0.0314, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Enum like class that is configured with a list of values.\n\n This class effectively implements an enum for Elements, except for that\n the actual values of the enums will be the string values.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L157_C2", "label": "__init__", "type": "function", "loc": [157, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:ClassDef_L150_C0", "vector": [2, 1, 0.9937, 0.0189, 1, 0.76, 1.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "values"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *values):\n for name in values:\n setattr(self, name, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L158_C4", "label": "for name", "type": "for", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L157_C2", "vector": [6, 2, 0.9969, 0.0126, 2, 0.84, 0.0, 57, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in values:\n setattr(self, name, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L159_C6", "label": "setattr()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L158_C4", "vector": [8, 3, 1.0, 0.0063, 3, 0.06, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, name, name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L117_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Assign_L139_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L140_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L145_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:If_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Return_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:FunctionDef_L157_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1126:For_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1126:Expr_L159_C6"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Declares the api package."""
| ajibawa-2023/Python-Code-Large/train/row_1127 | 1 | 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_1127:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0588, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Declares the api package.\"\"\""}] | [] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the blip module."""
import unittest
import blip
import element
import ops
import simplejson
TEST_BLIP_DATA = {
'childBlipIds': [],
'content': '\nhello world!\nanother line',
'contributors': ['robot@test.com', 'user@test.com'],
'creator': 'user@test.com',
'lastModifiedTime': 1000,
'parentBlipId': None,
'annotations': [{'range': {'start': 2, 'end': 3},
'name': 'key', 'value': 'val'}],
'waveId': 'test.com!w+g3h3im',
'waveletId': 'test.com!root+conv',
'elements':{'14':{'type':'GADGET','properties':{'url':'http://a/b.xml'}}},
}
CHILD_BLIP_ID = 'b+42'
ROOT_BLIP_ID = 'b+43'
class TestBlip(unittest.TestCase):
"""Tests the primary data structures for the wave model."""
def assertBlipStartswith(self, expected, totest):
actual = totest.text[:len(expected)]
self.assertEquals(expected, actual)
def new_blip(self, **args):
"""Create a blip for testing."""
data = TEST_BLIP_DATA.copy()
data.update(args)
res = blip.Blip(data, self.all_blips, self.operation_queue)
self.all_blips[res.blip_id] = res
return res
def setUp(self):
self.all_blips = {}
self.operation_queue = ops.OperationQueue()
def testBlipProperties(self):
root = self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID])
child = self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
self.assertEquals(ROOT_BLIP_ID, root.blip_id)
self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)
self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)
self.assertEquals(TEST_BLIP_DATA['creator'], root.creator)
self.assertEquals(TEST_BLIP_DATA['content'], root.text)
self.assertEquals(TEST_BLIP_DATA['lastModifiedTime'],
root.last_modified_time)
self.assertEquals(TEST_BLIP_DATA['parentBlipId'], root.parent_blip_id)
self.assertEquals(TEST_BLIP_DATA['waveId'], root.wave_id)
self.assertEquals(TEST_BLIP_DATA['waveletId'], root.wavelet_id)
self.assertEquals(TEST_BLIP_DATA['content'][3], root[3])
self.assertEquals(element.Gadget.class_type, root[14].type)
self.assertEquals('http://a/b.xml', root[14].url)
self.assertEquals('a', root.text[14])
self.assertEquals(len(TEST_BLIP_DATA['content']), len(root))
self.assertTrue(root.is_root())
self.assertFalse(child.is_root())
self.assertEquals(root, child.parent_blip)
def testBlipSerialize(self):
root = self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID])
serialized = root.serialize()
unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)
self.assertEquals(root.blip_id, unserialized.blip_id)
self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)
self.assertEquals(root.contributors, unserialized.contributors)
self.assertEquals(root.creator, unserialized.creator)
self.assertEquals(root.text, unserialized.text)
self.assertEquals(root.last_modified_time, unserialized.last_modified_time)
self.assertEquals(root.parent_blip_id, unserialized.parent_blip_id)
self.assertEquals(root.wave_id, unserialized.wave_id)
self.assertEquals(root.wavelet_id, unserialized.wavelet_id)
self.assertTrue(unserialized.is_root())
def testDocumentOperations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
newlines = [x for x in blip.find('\n')]
self.assertEquals(2, len(newlines))
blip.first('world').replace('jupiter')
bits = blip.text.split('\n')
self.assertEquals(3, len(bits))
self.assertEquals('hello jupiter!', bits[1])
blip.range(2, 5).delete()
self.assertBlipStartswith('\nho jupiter', blip)
blip.first('ho').insert_after('la')
self.assertBlipStartswith('\nhola jupiter', blip)
blip.at(3).insert(' ')
self.assertBlipStartswith('\nho la jupiter', blip)
def testElementHandling(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
url = 'http://www.test.com/image.png'
org_len = len(blip)
blip.append(element.Image(url=url))
elems = [elem for elem in blip.find(element.Image, url=url)]
self.assertEquals(1, len(elems))
elem = elems[0]
self.assertTrue(isinstance(elem, element.Image))
blip.at(1).insert('twelve chars')
self.assertTrue(blip.text.startswith('\ntwelve charshello'))
elem = blip[org_len + 12].value()
self.assertTrue(isinstance(elem, element.Image))
blip.first('twelve ').delete()
self.assertTrue(blip.text.startswith('\nchars'))
elem = blip[org_len + 12 - len('twelve ')].value()
self.assertTrue(isinstance(elem, element.Image))
blip.first('chars').replace(element.Image(url=url))
elems = [elem for elem in blip.find(element.Image, url=url)]
self.assertEquals(2, len(elems))
self.assertTrue(blip.text.startswith('\n hello'))
elem = blip[1].value()
self.assertTrue(isinstance(elem, element.Image))
def testAnnotationHandling(self):
key = 'style/fontWeight'
def get_bold():
for an in blip.annotations[key]:
if an.value == 'bold':
return an
return None
json = ('[{"range":{"start":3,"end":6},"name":"%s","value":"bold"}]'
% key)
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json))
self.assertEquals(1, len(blip.annotations))
self.assertNotEqual(None, get_bold().value)
self.assertTrue(key in blip.annotations)
# extend the bold annotation by adding:
blip.range(5, 8).annotate(key, 'bold')
self.assertEquals(1, len(blip.annotations))
self.assertEquals(8, get_bold().end)
# clip by adding a same keyed:
blip[4:12].annotate(key, 'italic')
self.assertEquals(2, len(blip.annotations[key]))
self.assertEquals(4, get_bold().end)
# now split the italic one:
blip.range(6, 7).clear_annotation(key)
self.assertEquals(3, len(blip.annotations[key]))
# test names and iteration
self.assertEquals(1, len(blip.annotations.names()))
self.assertEquals(3, len([x for x in blip.annotations]))
blip[3: 5].annotate('foo', 'bar')
self.assertEquals(2, len(blip.annotations.names()))
self.assertEquals(4, len([x for x in blip.annotations]))
blip[3: 5].clear_annotation('foo')
# clear the whole thing
blip.all().clear_annotation(key)
# getting to the key should now throw an exception
self.assertRaises(KeyError, blip.annotations.__getitem__, key)
def testBlipOperations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEquals(1, len(self.all_blips))
otherblip = blip.reply()
otherblip.append('hello world')
self.assertEquals('hello world', otherblip.text)
self.assertEquals(blip.blip_id, otherblip.parent_blip_id)
self.assertEquals(2, len(self.all_blips))
inline = blip.insert_inline_blip(3)
self.assertEquals(blip.blip_id, inline.parent_blip_id)
self.assertEquals(3, len(self.all_blips))
def testInsertInlineBlipCantInsertAtTheBeginning(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEquals(1, len(self.all_blips))
self.assertRaises(IndexError, blip.insert_inline_blip, 0)
self.assertEquals(1, len(self.all_blips))
def testDocumentModify(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('a text with text and then some text')
blip[7].insert('text ')
blip.all('text').replace('thing')
self.assertEquals('a thing thing with thing and then some thing',
blip.text)
def testIteration(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('aaa 012 aaa 345 aaa 322')
count = 0
prev = -1
for start, end in blip.all('aaa'):
count += 1
self.assertTrue(prev < start)
prev = start
self.assertEquals(3, count)
def testBlipRefValue(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
content = blip.text
content = content[:4] + content[5:]
del blip[4]
self.assertEquals(content, blip.text)
content = content[:2] + content[3:]
del blip[2:3]
self.assertEquals(content, blip.text)
blip[2:3] = 'bike'
content = content[:2] + 'bike' + content[3:]
self.assertEquals(content, blip.text)
url = 'http://www.test.com/image.png'
blip.append(element.Image(url=url))
self.assertEqual(url, blip.first(element.Image).url)
url2 = 'http://www.test.com/another.png'
blip[-1].update_element({'url': url2})
self.assertEqual(url2, blip.first(element.Image).url)
self.assertTrue(blip[3:5] == blip.text[3:5])
blip.append('geheim')
self.assertTrue(blip.first('geheim'))
self.assertFalse(blip.first(element.Button))
blip.append(element.Button(name='test1', value='Click'))
button = blip.first(element.Button)
button.update_element({'name': 'test2'})
self.assertEqual('test2', button.name)
def testReplace(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('\nxxxx')
blip.all('yyy').replace('zzz')
self.assertEqual('\nxxxx', blip.text)
def testDeleteRangeThatSpansAcrossAnnotationEndPoint(self):
json = ('[{"range":{"start":1,"end":3},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).delete()
self.assertEqual('\nF bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(2, blip.annotations['style'][0].end)
def testInsertBeforeAnnotationStartPoint(self):
json = ('[{"range":{"start":4,"end":9},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.at(4).insert('d and')
self.assertEqual('\nFood and bar.', blip.text)
self.assertEqual(9, blip.annotations['style'][0].start)
self.assertEqual(14, blip.annotations['style'][0].end)
def testDeleteRangeInsideAnnotation(self):
json = ('[{"range":{"start":1,"end":5},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).delete()
self.assertEqual('\nF bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(3, blip.annotations['style'][0].end)
def testReplaceInsideAnnotation(self):
json = ('[{"range":{"start":1,"end":5},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).replace('ooo')
self.assertEqual('\nFooo bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(6, blip.annotations['style'][0].end)
blip.range(2, 5).replace('o')
self.assertEqual('\nFo bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(4, blip.annotations['style'][0].end)
def testReplaceSpanAnnotation(self):
json = ('[{"range":{"start":1,"end":4},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 9).replace('')
self.assertEqual('\nF', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(2, blip.annotations['style'][0].end)
def testSearchWithNoMatchShouldNotGenerateOperation(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEqual(-1, blip.text.find(':('))
self.assertEqual(0, len(self.operation_queue))
blip.all(':(').replace(':)')
self.assertEqual(0, len(self.operation_queue))
def testBlipsRemoveWithId(self):
blip_dict = {
ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID]),
CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
}
blips = blip.Blips(blip_dict)
blips._remove_with_id(CHILD_BLIP_ID)
self.assertEqual(1, len(blips))
self.assertEqual(0, len(blips[ROOT_BLIP_ID].child_blip_ids))
def testAppendMarkup(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\nFoo bar.')
markup = '<p><span>markup<span> content</p>'
blip.append_markup(markup)
self.assertEqual(1, len(self.operation_queue))
self.assertEqual('\nFoo bar.\nmarkup content', blip.text)
def testBundledAnnotations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\nFoo bar.')
blip.append('not bold')
blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])
self.assertEqual(2, len(blip.annotations))
self.assertEqual('bold', blip.annotations['style/fontWeight'][0].value)
def testInlineBlipOffset(self):
offset = 14
self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID],
elements={str(offset):
{'type': element.Element.INLINE_BLIP_TYPE,
'properties': {'id': CHILD_BLIP_ID}}})
child = self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
self.assertEqual(offset, child.inline_blip_offset)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1129 | 253 | 374 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0027, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the blip module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0535, 0.0027, 0, 0.66, 0.1, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Import_L22_C0", "label": "blip import blip", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0027, 0, 0.66, 0.2, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0615, 0.0027, 0, 0.66, 0.3, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Import_L24_C0", "label": "ops import ops", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0642, 0.0027, 0, 0.66, 0.4, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Import_L25_C0", "label": "simplejson import simplejson", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0668, 0.0027, 0, 0.66, 0.5, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L27_C0", "label": "TEST_BLIP_DATA =", "type": "assigned_variable", "loc": [27, 39], "level": 0, "parent": null, "vector": [14, 0, 0.0882, 0.0348, 0, 0.66, 0.6, 853, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_BLIP_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_BLIP_DATA = {\n 'childBlipIds': [],\n 'content': '\\nhello world!\\nanother line',\n 'contributors': ['robot@test.com', 'user@test.com'],\n 'creator': 'user@test.com',\n 'lastModifiedTime': 1000,\n 'parentBlipId': None,\n 'annotations': [{'range': {'start': 2, 'end': 3},"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L41_C0", "label": "CHILD_BLIP_ID =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.1096, 0.0027, 0, 0.66, 0.7, 434, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CHILD_BLIP_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CHILD_BLIP_ID = 'b+42'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L42_C0", "label": "ROOT_BLIP_ID =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.1123, 0.0027, 0, 0.66, 0.8, 693, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_BLIP_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_BLIP_ID = 'b+43'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "label": "TestBlip", "type": "class", "loc": [45, 371], "level": 0, "parent": null, "vector": [3, 0, 0.5561, 0.8743, 0, 0.66, 0.9, 841, 0, 25, 0, 0, 878, 0, 99], "semantic": {"name": "TestBlip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestBlip(unittest.TestCase):\n \"\"\"Tests the primary data structures for the wave model.\"\"\"\n\n def assertBlipStartswith(self, expected, totest):\n actual = totest.text[:len(expected)]\n self.assertEquals(expected, actual)\n\n def new_blip(self, **args):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L46_C2", "label": "expression", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [8, 1, 0.123, 0.0027, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests the primary data structures for the wave model.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2", "label": "assertBlipStartswith", "type": "function", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.131, 0.008, 1, 0.59, 0.0417, 573, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "assertBlipStartswith", "arg_names": ["self", "expected", "totest"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertBlipStartswith(self, expected, totest):\n actual = totest.text[:len(expected)]\n self.assertEquals(expected, actual)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L49_C4", "label": "actual =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2", "vector": [14, 2, 0.131, 0.0027, 2, 0.18, 0.0, 331, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "actual", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " actual = totest.text[:len(expected)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L50_C4", "label": "assertEquals()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2", "vector": [8, 2, 0.1337, 0.0027, 2, 0.18, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(expected, actual)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "label": "new_blip", "type": "function", "loc": [52, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.1471, 0.0187, 1, 0.59, 0.0833, 893, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "new_blip", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_blip(self, **args):\n \"\"\"Create a blip for testing.\"\"\"\n data = TEST_BLIP_DATA.copy()\n data.update(args)\n res = blip.Blip(data, self.all_blips, self.operation_queue)\n self.all_blips[res.blip_id] = res\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [8, 2, 0.1417, 0.0027, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create a blip for testing.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L54_C4", "label": "data = copy()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [14, 2, 0.1444, 0.0027, 2, 0.6, 0.2, 929, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data = TEST_BLIP_DATA.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L55_C4", "label": "update()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [8, 2, 0.1471, 0.0027, 2, 0.6, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " data.update(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L56_C4", "label": "res = Blip()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [14, 2, 0.1497, 0.0027, 2, 0.6, 0.6, 413, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " res = blip.Blip(data, self.all_blips, self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L57_C4", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [14, 2, 0.1524, 0.0027, 2, 0.6, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips[res.blip_id] = res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "vector": [13, 2, 0.1551, 0.0027, 2, 0.6, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2", "label": "setUp", "type": "function", "loc": [60, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.1631, 0.008, 1, 0.59, 0.125, 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.all_blips = {}\n self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L61_C4", "label": "self.all_blips =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2", "vector": [14, 2, 0.1631, 0.0027, 2, 0.45, 0.0, 606, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.all_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L62_C4", "label": "self.operation_queue = OperationQueue()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2", "vector": [14, 2, 0.1658, 0.0027, 2, 0.45, 1.0, 118, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "self.operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "label": "testBlipProperties", "type": "function", "loc": [64, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.2005, 0.0615, 1, 0.59, 0.1667, 83, 0, 1, 0, 0, 0, 0, 25], "semantic": {"name": "testBlipProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipProperties(self):\n root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])\n child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n self.assertEquals(ROOT_BLIP_ID, root.blip_id)\n self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)\n self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L65_C4", "label": "root = new_blip()", "type": "assigned_variable", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [14, 2, 0.1751, 0.0053, 2, 0.93, 0.0, 696, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L67_C4", "label": "child = new_blip()", "type": "assigned_variable", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [14, 2, 0.1805, 0.0053, 2, 0.93, 0.0556, 967, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L69_C4", "label": "assertEquals()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1845, 0.0027, 2, 0.93, 0.1111, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ROOT_BLIP_ID, root.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L70_C4", "label": "assertEquals()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1872, 0.0027, 2, 0.93, 0.1667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1898, 0.0027, 2, 0.93, 0.2222, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1925, 0.0027, 2, 0.93, 0.2778, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['creator'], root.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1952, 0.0027, 2, 0.93, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['content'], root.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.1992, 0.0053, 2, 0.93, 0.3889, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['lastModifiedTime'],\n root.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L76_C4", "label": "assertEquals()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2032, 0.0027, 2, 0.93, 0.4444, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['parentBlipId'], root.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L77_C4", "label": "assertEquals()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2059, 0.0027, 2, 0.93, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['waveId'], root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2086, 0.0027, 2, 0.93, 0.5556, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['waveletId'], root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L79_C4", "label": "assertEquals()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2112, 0.0027, 2, 0.93, 0.6111, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['content'][3], root[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L80_C4", "label": "assertEquals()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2139, 0.0027, 2, 0.93, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, root[14].type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L81_C4", "label": "assertEquals()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2166, 0.0027, 2, 0.93, 0.7222, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('http://a/b.xml', root[14].url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L82_C4", "label": "assertEquals()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2193, 0.0027, 2, 0.93, 0.7778, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('a', root.text[14])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2219, 0.0027, 2, 0.93, 0.8333, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(TEST_BLIP_DATA['content']), len(root))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L84_C4", "label": "assertTrue()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2246, 0.0027, 2, 0.93, 0.8889, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(root.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L85_C4", "label": "assertFalse()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2273, 0.0027, 2, 0.93, 0.9444, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(child.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "vector": [8, 2, 0.2299, 0.0027, 2, 0.93, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root, child.parent_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "label": "testBlipSerialize", "type": "function", "loc": [88, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.254, 0.0401, 1, 0.59, 0.2083, 1, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "testBlipSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipSerialize(self):\n root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])\n serialized = root.serialize()\n unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)\n self.assertEquals(root.blip_id, unserialized.blip_id)\n self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)\n self.assertEquals(root.contributors, unserialized.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L89_C4", "label": "root = new_blip()", "type": "assigned_variable", "loc": [89, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [14, 2, 0.2393, 0.0053, 2, 0.29, 0.0, 696, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L91_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [14, 2, 0.2433, 0.0027, 2, 0.29, 0.0833, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = root.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L92_C4", "label": "unserialized = Blip()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [14, 2, 0.246, 0.0027, 2, 0.29, 0.1667, 161, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "unserialized", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L93_C4", "label": "assertEquals()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2487, 0.0027, 2, 0.29, 0.25, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.blip_id, unserialized.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L94_C4", "label": "assertEquals()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2513, 0.0027, 2, 0.29, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.254, 0.0027, 2, 0.29, 0.4167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.contributors, unserialized.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L96_C4", "label": "assertEquals()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2567, 0.0027, 2, 0.29, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.creator, unserialized.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L97_C4", "label": "assertEquals()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2594, 0.0027, 2, 0.29, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.text, unserialized.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L98_C4", "label": "assertEquals()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.262, 0.0027, 2, 0.29, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.last_modified_time, unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L99_C4", "label": "assertEquals()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2647, 0.0027, 2, 0.29, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.parent_blip_id, unserialized.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L100_C4", "label": "assertEquals()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2674, 0.0027, 2, 0.29, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.wave_id, unserialized.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L101_C4", "label": "assertEquals()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2701, 0.0027, 2, 0.29, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.wavelet_id, unserialized.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L102_C4", "label": "assertTrue()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "vector": [8, 2, 0.2727, 0.0027, 2, 0.29, 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(unserialized.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "label": "testDocumentOperations", "type": "function", "loc": [104, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.2968, 0.0401, 1, 0.59, 0.25, 764, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "testDocumentOperations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDocumentOperations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n newlines = [x for x in blip.find('\\n')]\n self.assertEquals(2, len(newlines))\n blip.first('world').replace('jupiter')\n bits = blip.text.split('\\n')\n self.assertEquals(3, len(bits))\n self.assertEquals('hello jupiter!', bits[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L105_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [14, 2, 0.2807, 0.0027, 2, 0.2, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L106_C4", "label": "newlines =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [14, 2, 0.2834, 0.0027, 2, 0.2, 0.0833, 73, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newlines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newlines = [x for x in blip.find('\\n')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.2861, 0.0027, 2, 0.2, 0.1667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(newlines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L108_C4", "label": "replace()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.2888, 0.0027, 2, 0.2, 0.25, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.first('world').replace('jupiter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L109_C4", "label": "bits = split()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [14, 2, 0.2914, 0.0027, 2, 0.2, 0.3333, 593, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "bits", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " bits = blip.text.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L110_C4", "label": "assertEquals()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.2941, 0.0027, 2, 0.2, 0.4167, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(bits))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L111_C4", "label": "assertEquals()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.2968, 0.0027, 2, 0.2, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('hello jupiter!', bits[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L112_C4", "label": "delete()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.2995, 0.0027, 2, 0.2, 0.5833, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 5).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L113_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.3021, 0.0027, 2, 0.2, 0.6667, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nho jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L115_C4", "label": "insert_after()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.3075, 0.0027, 2, 0.2, 0.75, 441, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert_after", "arg_names": [], "import_names": [], "rhs_call_name": "insert_after", "annotation": ""}, "snippet": " blip.first('ho').insert_after('la')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L116_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.3102, 0.0027, 2, 0.2, 0.8333, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nhola jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L117_C4", "label": "insert()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.3128, 0.0027, 2, 0.2, 0.9167, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(3).insert(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L118_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "vector": [8, 2, 0.3155, 0.0027, 2, 0.2, 1.0, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nho la jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "label": "testElementHandling", "type": "function", "loc": [120, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.3583, 0.0775, 1, 0.59, 0.2917, 772, 0, 1, 0, 0, 0, 0, 35], "semantic": {"name": "testElementHandling", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testElementHandling(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n url = 'http://www.test.com/image.png'\n\n org_len = len(blip)\n blip.append(element.Image(url=url))\n\n elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L121_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3235, 0.0027, 2, 0.68, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L122_C4", "label": "url =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3262, 0.0027, 2, 0.68, 0.0476, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.test.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L124_C4", "label": "org_len = len()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3316, 0.0027, 2, 0.68, 0.0952, 784, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "org_len", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " org_len = len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L125_C4", "label": "append()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3342, 0.0027, 2, 0.68, 0.1429, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L127_C4", "label": "elems =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3396, 0.0027, 2, 0.68, 0.1905, 280, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "elems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L128_C4", "label": "assertEquals()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3422, 0.0027, 2, 0.68, 0.2381, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(elems))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L129_C4", "label": "elem =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3449, 0.0027, 2, 0.68, 0.2857, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elem = elems[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L130_C4", "label": "assertTrue()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3476, 0.0027, 2, 0.68, 0.3333, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L131_C4", "label": "insert()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3503, 0.0027, 2, 0.68, 0.381, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(1).insert('twelve chars')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L132_C4", "label": "assertTrue()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3529, 0.0027, 2, 0.68, 0.4286, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\ntwelve charshello'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L134_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3583, 0.0027, 2, 0.68, 0.4762, 63, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[org_len + 12].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L135_C4", "label": "assertTrue()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.361, 0.0027, 2, 0.68, 0.5238, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L137_C4", "label": "delete()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3663, 0.0027, 2, 0.68, 0.5714, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.first('twelve ').delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L138_C4", "label": "assertTrue()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.369, 0.0027, 2, 0.68, 0.619, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\nchars'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L140_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.3743, 0.0027, 2, 0.68, 0.6667, 63, 3, 0, 0, 0, 441, 10, 2], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[org_len + 12 - len('twelve ')].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L141_C4", "label": "assertTrue()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.377, 0.0027, 2, 0.68, 0.7143, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L143_C4", "label": "replace()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3824, 0.0027, 2, 0.68, 0.7619, 293, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.first('chars').replace(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L144_C4", "label": "elems =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.385, 0.0027, 2, 0.68, 0.8095, 280, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "elems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3877, 0.0027, 2, 0.68, 0.8571, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(elems))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L146_C4", "label": "assertTrue()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3904, 0.0027, 2, 0.68, 0.9048, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\n hello'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L147_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [14, 2, 0.393, 0.0027, 2, 0.68, 0.9524, 63, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[1].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L148_C4", "label": "assertTrue()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "vector": [8, 2, 0.3957, 0.0027, 2, 0.68, 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(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "label": "testAnnotationHandling", "type": "function", "loc": [150, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.4572, 0.115, 1, 0.59, 0.3333, 403, 0, 1, 1, 0, 0, 0, 37], "semantic": {"name": "testAnnotationHandling", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAnnotationHandling(self):\n key = 'style/fontWeight'\n\n def get_bold():\n for an in blip.annotations[key]:\n if an.value == 'bold':\n return an\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L151_C4", "label": "key =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [14, 2, 0.4037, 0.0027, 2, 0.46, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'style/fontWeight'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4", "label": "get_bold", "type": "function", "loc": [153, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [2, 2, 0.4144, 0.0134, 2, 0.46, 0.0455, 163, 0, 0, 1, 0, 0, 0, 0], "semantic": {"name": "get_bold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_bold():\n for an in blip.annotations[key]:\n if an.value == 'bold':\n return an\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L154_C6", "label": "for an", "type": "for", "loc": [154, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4", "vector": [6, 3, 0.4144, 0.008, 3, 0.89, 0.0, 770, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "an", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for an in blip.annotations[key]:\n if an.value == 'bold':\n return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L155_C8", "label": "if", "type": "if", "loc": [155, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L154_C6", "vector": [4, 4, 0.4158, 0.0053, 4, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if an.value == 'bold':\n return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L156_C10", "label": "return", "type": "return", "loc": [156, 156], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L155_C8", "vector": [13, 5, 0.4171, 0.0027, 5, 0.5, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L157_C6", "label": "return", "type": "return", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4", "vector": [13, 3, 0.4198, 0.0027, 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_1129:Assign_L159_C4", "label": "json =", "type": "assigned_variable", "loc": [159, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [14, 2, 0.4265, 0.0053, 2, 0.46, 0.0909, 463, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":3,\"end\":6},\"name\":\"%s\",\"value\":\"bold\"}]'\n % key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L161_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [14, 2, 0.4318, 0.0053, 2, 0.46, 0.1364, 134, 3, 2, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L163_C4", "label": "assertEquals()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4358, 0.0027, 2, 0.46, 0.1818, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L164_C4", "label": "assertNotEqual()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4385, 0.0027, 2, 0.46, 0.2273, 120, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(None, get_bold().value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L165_C4", "label": "assertTrue()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4412, 0.0027, 2, 0.46, 0.2727, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(key in blip.annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L168_C4", "label": "annotate()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4492, 0.0027, 2, 0.46, 0.3182, 296, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip.range(5, 8).annotate(key, 'bold')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L169_C4", "label": "assertEquals()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4519, 0.0027, 2, 0.46, 0.3636, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L170_C4", "label": "assertEquals()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4545, 0.0027, 2, 0.46, 0.4091, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(8, get_bold().end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L173_C4", "label": "annotate()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4626, 0.0027, 2, 0.46, 0.4545, 296, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip[4:12].annotate(key, 'italic')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L174_C4", "label": "assertEquals()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4652, 0.0027, 2, 0.46, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(blip.annotations[key]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L175_C4", "label": "assertEquals()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4679, 0.0027, 2, 0.46, 0.5455, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(4, get_bold().end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L178_C4", "label": "clear_annotation()", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4759, 0.0027, 2, 0.46, 0.5909, 359, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip.range(6, 7).clear_annotation(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L179_C4", "label": "assertEquals()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4786, 0.0027, 2, 0.46, 0.6364, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(blip.annotations[key]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L182_C4", "label": "assertEquals()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4866, 0.0027, 2, 0.46, 0.6818, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations.names()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L183_C4", "label": "assertEquals()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4893, 0.0027, 2, 0.46, 0.7273, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len([x for x in blip.annotations]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L184_C4", "label": "annotate()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.492, 0.0027, 2, 0.46, 0.7727, 296, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip[3: 5].annotate('foo', 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L185_C4", "label": "assertEquals()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4947, 0.0027, 2, 0.46, 0.8182, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(blip.annotations.names()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L186_C4", "label": "assertEquals()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.4973, 0.0027, 2, 0.46, 0.8636, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(4, len([x for x in blip.annotations]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L187_C4", "label": "clear_annotation()", "type": "expression", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.5, 0.0027, 2, 0.46, 0.9091, 359, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip[3: 5].clear_annotation('foo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L190_C4", "label": "clear_annotation()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.508, 0.0027, 2, 0.46, 0.9545, 359, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip.all().clear_annotation(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L192_C4", "label": "assertRaises()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "vector": [8, 2, 0.5134, 0.0027, 2, 0.46, 1.0, 11, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertRaises", "arg_names": [], "import_names": [], "rhs_call_name": "assertRaises", "annotation": ""}, "snippet": " self.assertRaises(KeyError, blip.annotations.__getitem__, key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "label": "testBlipOperations", "type": "function", "loc": [194, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.5348, 0.0348, 1, 0.59, 0.375, 837, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "testBlipOperations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipOperations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEquals(1, len(self.all_blips))\n\n otherblip = blip.reply()\n otherblip.append('hello world')\n self.assertEquals('hello world', otherblip.text)\n self.assertEquals(blip.blip_id, otherblip.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L195_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [14, 2, 0.5214, 0.0027, 2, 0.97, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L196_C4", "label": "assertEquals()", "type": "expression", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5241, 0.0027, 2, 0.97, 0.1111, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L198_C4", "label": "otherblip = reply()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [14, 2, 0.5294, 0.0027, 2, 0.97, 0.2222, 259, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "otherblip", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " otherblip = blip.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L199_C4", "label": "append()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5321, 0.0027, 2, 0.97, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " otherblip.append('hello world')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L200_C4", "label": "assertEquals()", "type": "expression", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5348, 0.0027, 2, 0.97, 0.4444, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('hello world', otherblip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L201_C4", "label": "assertEquals()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5374, 0.0027, 2, 0.97, 0.5556, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(blip.blip_id, otherblip.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L202_C4", "label": "assertEquals()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5401, 0.0027, 2, 0.97, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L204_C4", "label": "inline = insert_inline_blip()", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [14, 2, 0.5455, 0.0027, 2, 0.97, 0.7778, 7, 3, 1, 0, 0, 203, 10, 1], "semantic": {"name": "inline", "arg_names": [], "import_names": [], "rhs_call_name": "insert_inline_blip", "annotation": ""}, "snippet": " inline = blip.insert_inline_blip(3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L205_C4", "label": "assertEquals()", "type": "expression", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5481, 0.0027, 2, 0.97, 0.8889, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(blip.blip_id, inline.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L206_C4", "label": "assertEquals()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "vector": [8, 2, 0.5508, 0.0027, 2, 0.97, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "label": "testInsertInlineBlipCantInsertAtTheBeginning", "type": "function", "loc": [208, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.5615, 0.0134, 1, 0.59, 0.4167, 748, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testInsertInlineBlipCantInsertAtTheBeginning", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInsertInlineBlipCantInsertAtTheBeginning(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEquals(1, len(self.all_blips))\n self.assertRaises(IndexError, blip.insert_inline_blip, 0)\n self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L209_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "vector": [14, 2, 0.5588, 0.0027, 2, 0.1, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L210_C4", "label": "assertEquals()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "vector": [8, 2, 0.5615, 0.0027, 2, 0.1, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L211_C4", "label": "assertRaises()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "vector": [8, 2, 0.5642, 0.0027, 2, 0.1, 0.6667, 11, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertRaises", "arg_names": [], "import_names": [], "rhs_call_name": "assertRaises", "annotation": ""}, "snippet": " self.assertRaises(IndexError, blip.insert_inline_blip, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L212_C4", "label": "assertEquals()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "vector": [8, 2, 0.5668, 0.0027, 2, 0.1, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "label": "testDocumentModify", "type": "function", "loc": [214, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.5802, 0.0187, 1, 0.59, 0.4583, 35, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDocumentModify", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDocumentModify(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('a text with text and then some text')\n blip[7].insert('text ')\n blip.all('text').replace('thing')\n self.assertEquals('a thing thing with thing and then some thing',\n blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L215_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "vector": [14, 2, 0.5749, 0.0027, 2, 0.61, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L216_C4", "label": "replace()", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "vector": [8, 2, 0.5775, 0.0027, 2, 0.61, 0.25, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('a text with text and then some text')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L217_C4", "label": "insert()", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "vector": [8, 2, 0.5802, 0.0027, 2, 0.61, 0.5, 368, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip[7].insert('text ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L218_C4", "label": "replace()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "vector": [8, 2, 0.5829, 0.0027, 2, 0.61, 0.75, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all('text').replace('thing')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L219_C4", "label": "assertEquals()", "type": "expression", "loc": [219, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "vector": [8, 2, 0.5869, 0.0053, 2, 0.61, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('a thing thing with thing and then some thing',\n blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "label": "testIteration", "type": "function", "loc": [222, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.6056, 0.0267, 1, 0.59, 0.5, 806, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testIteration", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIteration(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('aaa 012 aaa 345 aaa 322')\n count = 0\n prev = -1\n for start, end in blip.all('aaa'):\n count += 1\n self.assertTrue(prev < start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L223_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [14, 2, 0.5963, 0.0027, 2, 0.72, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L224_C4", "label": "replace()", "type": "expression", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [8, 2, 0.5989, 0.0027, 2, 0.72, 0.2, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('aaa 012 aaa 345 aaa 322')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L225_C4", "label": "count =", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [14, 2, 0.6016, 0.0027, 2, 0.72, 0.4, 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_1129:Assign_L226_C4", "label": "prev =", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [14, 2, 0.6043, 0.0027, 2, 0.72, 0.6, 749, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4", "label": "for start, end", "type": "for", "loc": [227, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [6, 2, 0.611, 0.0107, 2, 0.72, 0.8, 670, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in blip.all('aaa'):\n count += 1\n self.assertTrue(prev < start)\n prev = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L229_C6", "label": "assertTrue()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4", "vector": [8, 3, 0.6123, 0.0027, 3, 0.66, 0.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(prev < start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L230_C6", "label": "prev =", "type": "assigned_variable", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4", "vector": [14, 3, 0.615, 0.0027, 3, 0.66, 1.0, 749, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L231_C4", "label": "assertEquals()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "vector": [8, 2, 0.6176, 0.0027, 2, 0.72, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "label": "testBlipRefValue", "type": "function", "loc": [234, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.6671, 0.0856, 1, 0.59, 0.5417, 423, 0, 1, 0, 0, 0, 0, 22], "semantic": {"name": "testBlipRefValue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipRefValue(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n content = blip.text\n content = content[:4] + content[5:]\n del blip[4]\n self.assertEquals(content, blip.text)\n\n content = content[:2] + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L235_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6283, 0.0027, 2, 0.12, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L236_C4", "label": "content =", "type": "assigned_variable", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.631, 0.0027, 2, 0.12, 0.0455, 273, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = blip.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L237_C4", "label": "content =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6337, 0.0027, 2, 0.12, 0.0909, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:4] + content[5:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L239_C4", "label": "assertEquals()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.639, 0.0027, 2, 0.12, 0.1364, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L241_C4", "label": "content =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6444, 0.0027, 2, 0.12, 0.1818, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:2] + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L243_C4", "label": "assertEquals()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6497, 0.0027, 2, 0.12, 0.2273, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L245_C4", "label": "assign", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6551, 0.0027, 2, 0.12, 0.2727, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip[2:3] = 'bike'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L246_C4", "label": "content =", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6578, 0.0027, 2, 0.12, 0.3182, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:2] + 'bike' + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L247_C4", "label": "assertEquals()", "type": "expression", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6604, 0.0027, 2, 0.12, 0.3636, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L249_C4", "label": "url =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6658, 0.0027, 2, 0.12, 0.4091, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.test.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L250_C4", "label": "append()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6684, 0.0027, 2, 0.12, 0.4545, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L251_C4", "label": "assertEqual()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6711, 0.0027, 2, 0.12, 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(url, blip.first(element.Image).url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L253_C4", "label": "url2 =", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.6765, 0.0027, 2, 0.12, 0.5455, 325, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url2 = 'http://www.test.com/another.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L254_C4", "label": "update_element()", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6791, 0.0027, 2, 0.12, 0.5909, 879, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": [], "import_names": [], "rhs_call_name": "update_element", "annotation": ""}, "snippet": " blip[-1].update_element({'url': url2})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L255_C4", "label": "assertEqual()", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6818, 0.0027, 2, 0.12, 0.6364, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(url2, blip.first(element.Image).url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L257_C4", "label": "assertTrue()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6872, 0.0027, 2, 0.12, 0.6818, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip[3:5] == blip.text[3:5])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L259_C4", "label": "append()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6925, 0.0027, 2, 0.12, 0.7273, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('geheim')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L260_C4", "label": "assertTrue()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6952, 0.0027, 2, 0.12, 0.7727, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.first('geheim'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L261_C4", "label": "assertFalse()", "type": "expression", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.6979, 0.0027, 2, 0.12, 0.8182, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(blip.first(element.Button))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L262_C4", "label": "append()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.7005, 0.0027, 2, 0.12, 0.8636, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Button(name='test1', value='Click'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L263_C4", "label": "button = first()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [14, 2, 0.7032, 0.0027, 2, 0.12, 0.9091, 95, 3, 1, 0, 0, 199, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "first", "annotation": ""}, "snippet": " button = blip.first(element.Button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L264_C4", "label": "update_element()", "type": "expression", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.7059, 0.0027, 2, 0.12, 0.9545, 879, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": [], "import_names": [], "rhs_call_name": "update_element", "annotation": ""}, "snippet": " button.update_element({'name': 'test2'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L265_C4", "label": "assertEqual()", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "vector": [8, 2, 0.7086, 0.0027, 2, 0.12, 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('test2', button.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "label": "testReplace", "type": "function", "loc": [267, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.7193, 0.0134, 1, 0.59, 0.5833, 144, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testReplace", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplace(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('\\nxxxx')\n blip.all('yyy').replace('zzz')\n self.assertEqual('\\nxxxx', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L268_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "vector": [14, 2, 0.7166, 0.0027, 2, 0.55, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L269_C4", "label": "replace()", "type": "expression", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "vector": [8, 2, 0.7193, 0.0027, 2, 0.55, 0.3333, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('\\nxxxx')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L270_C4", "label": "replace()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "vector": [8, 2, 0.7219, 0.0027, 2, 0.55, 0.6667, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all('yyy').replace('zzz')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L271_C4", "label": "assertEqual()", "type": "expression", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "vector": [8, 2, 0.7246, 0.0027, 2, 0.55, 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('\\nxxxx', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "label": "testDeleteRangeThatSpansAcrossAnnotationEndPoint", "type": "function", "loc": [273, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.7406, 0.0241, 1, 0.59, 0.625, 559, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDeleteRangeThatSpansAcrossAnnotationEndPoint", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDeleteRangeThatSpansAcrossAnnotationEndPoint(self):\n json = ('[{\"range\":{\"start\":1,\"end\":3},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).delete()\n self.assertEqual('\\nF bar.', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L274_C4", "label": "json =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [14, 2, 0.7326, 0.0027, 2, 0.22, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":3},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L275_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [275, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [14, 2, 0.738, 0.008, 2, 0.22, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L278_C4", "label": "delete()", "type": "expression", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [8, 2, 0.7433, 0.0027, 2, 0.22, 0.4, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 4).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L279_C4", "label": "assertEqual()", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [8, 2, 0.746, 0.0027, 2, 0.22, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L280_C4", "label": "assertEqual()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [8, 2, 0.7487, 0.0027, 2, 0.22, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L281_C4", "label": "assertEqual()", "type": "expression", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "vector": [8, 2, 0.7513, 0.0027, 2, 0.22, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "label": "testInsertBeforeAnnotationStartPoint", "type": "function", "loc": [283, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.7674, 0.0241, 1, 0.59, 0.6667, 402, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testInsertBeforeAnnotationStartPoint", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInsertBeforeAnnotationStartPoint(self):\n json = ('[{\"range\":{\"start\":4,\"end\":9},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.at(4).insert('d and')\n self.assertEqual('\\nFood and bar.', blip.text)\n self.assertEqual(9, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L284_C4", "label": "json =", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [14, 2, 0.7594, 0.0027, 2, 0.12, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":4,\"end\":9},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L285_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [285, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [14, 2, 0.7647, 0.008, 2, 0.12, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L288_C4", "label": "insert()", "type": "expression", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [8, 2, 0.7701, 0.0027, 2, 0.12, 0.4, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(4).insert('d and')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L289_C4", "label": "assertEqual()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [8, 2, 0.7727, 0.0027, 2, 0.12, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nFood and bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L290_C4", "label": "assertEqual()", "type": "expression", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [8, 2, 0.7754, 0.0027, 2, 0.12, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(9, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L291_C4", "label": "assertEqual()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "vector": [8, 2, 0.7781, 0.0027, 2, 0.12, 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(14, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "label": "testDeleteRangeInsideAnnotation", "type": "function", "loc": [293, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.7955, 0.0267, 1, 0.59, 0.7083, 406, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDeleteRangeInsideAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDeleteRangeInsideAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).delete()\n\n self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L294_C4", "label": "json =", "type": "assigned_variable", "loc": [294, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [14, 2, 0.7861, 0.0027, 2, 0.21, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L295_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [295, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [14, 2, 0.7914, 0.008, 2, 0.21, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L298_C4", "label": "delete()", "type": "expression", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [8, 2, 0.7968, 0.0027, 2, 0.21, 0.4, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 4).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L300_C4", "label": "assertEqual()", "type": "expression", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [8, 2, 0.8021, 0.0027, 2, 0.21, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L301_C4", "label": "assertEqual()", "type": "expression", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [8, 2, 0.8048, 0.0027, 2, 0.21, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L302_C4", "label": "assertEqual()", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "vector": [8, 2, 0.8075, 0.0027, 2, 0.21, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "label": "testReplaceInsideAnnotation", "type": "function", "loc": [304, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.8302, 0.0374, 1, 0.59, 0.75, 841, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testReplaceInsideAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplaceInsideAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).replace('ooo')\n self.assertEqual('\\nFooo bar.', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L305_C4", "label": "json =", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [14, 2, 0.8155, 0.0027, 2, 0.64, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L306_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [306, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [14, 2, 0.8209, 0.008, 2, 0.64, 0.1111, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L309_C4", "label": "replace()", "type": "expression", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8262, 0.0027, 2, 0.64, 0.2222, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 4).replace('ooo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L310_C4", "label": "assertEqual()", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8289, 0.0027, 2, 0.64, 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('\\nFooo bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L311_C4", "label": "assertEqual()", "type": "expression", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8316, 0.0027, 2, 0.64, 0.4444, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L312_C4", "label": "assertEqual()", "type": "expression", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8342, 0.0027, 2, 0.64, 0.5556, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(6, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L314_C4", "label": "replace()", "type": "expression", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8396, 0.0027, 2, 0.64, 0.6667, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 5).replace('o')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L315_C4", "label": "assertEqual()", "type": "expression", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8422, 0.0027, 2, 0.64, 0.7778, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nFo bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L316_C4", "label": "assertEqual()", "type": "expression", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8449, 0.0027, 2, 0.64, 0.8889, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L317_C4", "label": "assertEqual()", "type": "expression", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "vector": [8, 2, 0.8476, 0.0027, 2, 0.64, 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(4, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "label": "testReplaceSpanAnnotation", "type": "function", "loc": [319, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.8636, 0.0241, 1, 0.59, 0.7917, 938, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testReplaceSpanAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplaceSpanAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":4},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 9).replace('')\n self.assertEqual('\\nF', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L320_C4", "label": "json =", "type": "assigned_variable", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [14, 2, 0.8556, 0.0027, 2, 0.54, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":4},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L321_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [321, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [14, 2, 0.861, 0.008, 2, 0.54, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L324_C4", "label": "replace()", "type": "expression", "loc": [324, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [8, 2, 0.8663, 0.0027, 2, 0.54, 0.4, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 9).replace('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L325_C4", "label": "assertEqual()", "type": "expression", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [8, 2, 0.869, 0.0027, 2, 0.54, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L326_C4", "label": "assertEqual()", "type": "expression", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [8, 2, 0.8717, 0.0027, 2, 0.54, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L327_C4", "label": "assertEqual()", "type": "expression", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "vector": [8, 2, 0.8743, 0.0027, 2, 0.54, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "label": "testSearchWithNoMatchShouldNotGenerateOperation", "type": "function", "loc": [329, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.8864, 0.016, 1, 0.59, 0.8333, 585, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSearchWithNoMatchShouldNotGenerateOperation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSearchWithNoMatchShouldNotGenerateOperation(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEqual(-1, blip.text.find(':('))\n self.assertEqual(0, len(self.operation_queue))\n blip.all(':(').replace(':)')\n self.assertEqual(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L330_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "vector": [14, 2, 0.8824, 0.0027, 2, 0.72, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L331_C4", "label": "assertEqual()", "type": "expression", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "vector": [8, 2, 0.885, 0.0027, 2, 0.72, 0.25, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(-1, blip.text.find(':('))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L332_C4", "label": "assertEqual()", "type": "expression", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "vector": [8, 2, 0.8877, 0.0027, 2, 0.72, 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(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L333_C4", "label": "replace()", "type": "expression", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "vector": [8, 2, 0.8904, 0.0027, 2, 0.72, 0.75, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all(':(').replace(':)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L334_C4", "label": "assertEqual()", "type": "expression", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "vector": [8, 2, 0.893, 0.0027, 2, 0.72, 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(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "label": "testBlipsRemoveWithId", "type": "function", "loc": [336, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.9118, 0.0294, 1, 0.59, 0.875, 636, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testBlipsRemoveWithId", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipsRemoveWithId(self):\n blip_dict = {\n ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID]),\n CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n }\n blips = blip.Blips(blip_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L337_C4", "label": "blip_dict =", "type": "assigned_variable", "loc": [337, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "vector": [14, 2, 0.9078, 0.016, 2, 0.21, 0.0, 213, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "blip_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_dict = {\n ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID]),\n CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L343_C4", "label": "blips = Blips()", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "vector": [14, 2, 0.9171, 0.0027, 2, 0.21, 0.25, 391, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " blips = blip.Blips(blip_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L344_C4", "label": "_remove_with_id()", "type": "expression", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "vector": [8, 2, 0.9198, 0.0027, 2, 0.21, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": [], "import_names": [], "rhs_call_name": "_remove_with_id", "annotation": ""}, "snippet": " blips._remove_with_id(CHILD_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L345_C4", "label": "assertEqual()", "type": "expression", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "vector": [8, 2, 0.9225, 0.0027, 2, 0.21, 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(blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L346_C4", "label": "assertEqual()", "type": "expression", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "vector": [8, 2, 0.9251, 0.0027, 2, 0.21, 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(0, len(blips[ROOT_BLIP_ID].child_blip_ids))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "label": "testAppendMarkup", "type": "function", "loc": [348, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.9372, 0.016, 1, 0.59, 0.9167, 371, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testAppendMarkup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAppendMarkup(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')\n markup = '<p><span>markup<span> content</p>'\n blip.append_markup(markup)\n self.assertEqual(1, len(self.operation_queue))\n self.assertEqual('\\nFoo bar.\\nmarkup content', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L349_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "vector": [14, 2, 0.9332, 0.0027, 2, 0.26, 0.0, 134, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L350_C4", "label": "markup =", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "vector": [14, 2, 0.9358, 0.0027, 2, 0.26, 0.25, 922, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "markup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markup = '<p><span>markup<span> content</p>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L351_C4", "label": "append_markup()", "type": "expression", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "vector": [8, 2, 0.9385, 0.0027, 2, 0.26, 0.5, 513, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "append_markup", "annotation": ""}, "snippet": " blip.append_markup(markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L352_C4", "label": "assertEqual()", "type": "expression", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "vector": [8, 2, 0.9412, 0.0027, 2, 0.26, 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(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L353_C4", "label": "assertEqual()", "type": "expression", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "vector": [8, 2, 0.9439, 0.0027, 2, 0.26, 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('\\nFoo bar.\\nmarkup content', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "label": "testBundledAnnotations", "type": "function", "loc": [355, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.9559, 0.016, 1, 0.59, 0.9583, 926, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testBundledAnnotations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBundledAnnotations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')\n blip.append('not bold')\n blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])\n self.assertEqual(2, len(blip.annotations))\n self.assertEqual('bold', blip.annotations['style/fontWeight'][0].value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L356_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "vector": [14, 2, 0.9519, 0.0027, 2, 0.93, 0.0, 134, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L357_C4", "label": "append()", "type": "expression", "loc": [357, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "vector": [8, 2, 0.9545, 0.0027, 2, 0.93, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('not bold')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L358_C4", "label": "append()", "type": "expression", "loc": [358, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "vector": [8, 2, 0.9572, 0.0027, 2, 0.93, 0.5, 243, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L359_C4", "label": "assertEqual()", "type": "expression", "loc": [359, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "vector": [8, 2, 0.9599, 0.0027, 2, 0.93, 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(2, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L360_C4", "label": "assertEqual()", "type": "expression", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "vector": [8, 2, 0.9626, 0.0027, 2, 0.93, 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('bold', blip.annotations['style/fontWeight'][0].value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "label": "testInlineBlipOffset", "type": "function", "loc": [362, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "vector": [2, 1, 0.9799, 0.0267, 1, 0.59, 1.0, 458, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testInlineBlipOffset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInlineBlipOffset(self):\n offset = 14\n self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID],\n elements={str(offset):\n {'type': element.Element.INLINE_BLIP_TYPE,\n 'properties': {'id': CHILD_BLIP_ID}}})\n child = self.new_blip(blipId=CHILD_BLIP_ID,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L363_C4", "label": "offset =", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "vector": [14, 2, 0.9706, 0.0027, 2, 0.86, 0.0, 132, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " offset = 14"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L364_C4", "label": "new_blip()", "type": "expression", "loc": [364, 368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "vector": [8, 2, 0.9786, 0.0134, 2, 0.86, 0.3333, 893, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID],\n elements={str(offset):\n {'type': element.Element.INLINE_BLIP_TYPE,\n 'properties': {'id': CHILD_BLIP_ID}}})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L369_C4", "label": "child = new_blip()", "type": "assigned_variable", "loc": [369, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "vector": [14, 2, 0.988, 0.0053, 2, 0.86, 0.6667, 967, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L371_C4", "label": "assertEqual()", "type": "expression", "loc": [371, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "vector": [8, 2, 0.992, 0.0027, 2, 0.86, 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(offset, child.inline_blip_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L373_C0", "label": "if", "type": "if", "loc": [373, 374], "level": 0, "parent": null, "vector": [4, 0, 0.9987, 0.0053, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L374_C2", "label": "main()", "type": "expression", "loc": [374, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L373_C0", "vector": [8, 1, 1.0, 0.0027, 1, 0.66, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L154_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L154_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L156_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Return_L157_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L229_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:For_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L230_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1129:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1129:Expr_L374_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Module defines the ModuleTestRunnerClass."""
import unittest
class ModuleTestRunner(object):
"""Responsible for executing all test cases in a list of modules."""
def __init__(self, module_list=None, module_test_settings=None):
self.modules = module_list or []
self.settings = module_test_settings or {}
def RunAllTests(self):
"""Executes all tests present in the list of modules."""
runner = unittest.TextTestRunner()
for module in self.modules:
for setting, value in self.settings.iteritems():
try:
setattr(module, setting, value)
except AttributeError:
print '\nError running ' + str(setting)
print '\nRunning all tests in module', module.__name__
runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))
| ajibawa-2023/Python-Code-Large/train/row_1130 | 17 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.425, 0.025, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Module defines the ModuleTestRunnerClass.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.025, 0, 0.66, 0.5, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "label": "ModuleTestRunner", "type": "class", "loc": [23, 40], "level": 0, "parent": null, "vector": [3, 0, 0.7875, 0.45, 0, 0.66, 1.0, 109, 0, 2, 0, 0, 186, 0, 8], "semantic": {"name": "ModuleTestRunner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModuleTestRunner(object):\n \"\"\"Responsible for executing all test cases in a list of modules.\"\"\"\n\n def __init__(self, module_list=None, module_test_settings=None):\n self.modules = module_list or []\n self.settings = module_test_settings or {}\n\n def RunAllTests(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L24_C2", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "vector": [8, 1, 0.6, 0.025, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Responsible for executing all test cases in a list of modules.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2", "label": "__init__", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "vector": [2, 1, 0.675, 0.075, 1, 0.34, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "module_list", "module_test_settings"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, module_list=None, module_test_settings=None):\n self.modules = module_list or []\n self.settings = module_test_settings or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L27_C4", "label": "self.modules =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2", "vector": [14, 2, 0.675, 0.025, 2, 0.34, 0.0, 847, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.modules", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modules = module_list or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L28_C4", "label": "self.settings =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2", "vector": [14, 2, 0.7, 0.025, 2, 0.34, 1.0, 673, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.settings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.settings = module_test_settings or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "label": "RunAllTests", "type": "function", "loc": [30, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "vector": [2, 1, 0.875, 0.275, 1, 0.34, 1.0, 52, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "RunAllTests", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def RunAllTests(self):\n \"\"\"Executes all tests present in the list of modules.\"\"\"\n runner = unittest.TextTestRunner()\n for module in self.modules:\n for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "vector": [8, 2, 0.775, 0.025, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Executes all tests present in the list of modules.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L32_C4", "label": "runner = TextTestRunner()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "vector": [14, 2, 0.8, 0.025, 2, 0.86, 0.5, 180, 3, 0, 0, 0, 130, 10, 1], "semantic": {"name": "runner", "arg_names": [], "import_names": [], "rhs_call_name": "TextTestRunner", "annotation": ""}, "snippet": " runner = unittest.TextTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "label": "for module", "type": "for", "loc": [33, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "vector": [6, 2, 0.9125, 0.2, 2, 0.86, 1.0, 98, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for module in self.modules:\n for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))\n print('\\nRunning all tests in module', module.__name__)\n runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L34_C6", "label": "for setting, value", "type": "for", "loc": [34, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "vector": [6, 3, 0.9, 0.125, 3, 0.95, 0.0, 571, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "setting, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8", "label": "try", "type": "try", "loc": [35, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L34_C6", "vector": [7, 4, 0.9125, 0.1, 4, 0.87, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L36_C10", "label": "setattr()", "type": "expression", "loc": [36, 36], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8", "vector": [8, 5, 0.9, 0.025, 5, 0.59, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(module, setting, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L38_C10", "label": "print()", "type": "expression", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8", "vector": [8, 5, 0.95, 0.025, 5, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L39_C6", "label": "print()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "vector": [8, 3, 0.975, 0.025, 3, 0.95, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nRunning all tests in module', module.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L40_C6", "label": "run()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "vector": [8, 3, 1.0, 0.025, 3, 0.95, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L34_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L34_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L36_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L38_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1130:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1130:Expr_L40_C6"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Defines event types that are sent from the wave server.
This module defines all of the event types currently supported by the wave
server. Each event type is sub classed from Event and has its own
properties depending on the type.
"""
class Context(object):
"""Specifies constants representing different context requests."""
#: Requests the root blip.
ROOT = 'ROOT'
#: Requests the parent blip of the event blip.
PARENT = 'PARENT'
#: Requests the siblings blip of the event blip.
SIBLINGS = 'SIBLINGS'
#: Requests the child blips of the event blip.
CHILDREN = 'CHILDREN'
#: Requests the event blip itself.
SELF = 'SELF'
#: Requests all of the blips of the event wavelet.
ALL = 'ALL'
class Event(object):
"""Object describing a single event.
Attributes:
modified_by: Participant id that caused this event.
timestamp: Timestamp that this event occurred on the server.
type: Type string of this event.
properties: Dictionary of all extra properties. Typically the derrived
event type should have these explicitly set as attributes, but
experimental features might appear in properties before that.
blip_id: The blip_id of the blip for blip related events or the root
blip for wavelet related events.
blip: If available, the blip with id equal to the events blip_id.
proxying_for: If available, the proxyingFor id of the robot that caused the
event.
"""
def __init__(self, json, wavelet):
"""Inits this event with JSON data.
Args:
json: JSON data from Wave server.
"""
self.modified_by = json.get('modifiedBy')
self.timestamp = json.get('timestamp', 0)
self.type = json.get('type')
self.raw_data = json
self.properties = json.get('properties', {})
self.blip_id = self.properties.get('blipId')
self.blip = wavelet.blips.get(self.blip_id)
self.proxying_for = json.get('proxyingFor')
class WaveletBlipCreated(Event):
"""Event triggered when a new blip is created.
Attributes:
new_blip_id: The id of the newly created blip.
new_blip: If in context, the actual new blip.
"""
type = 'WAVELET_BLIP_CREATED'
def __init__(self, json, wavelet):
super(WaveletBlipCreated, self).__init__(json, wavelet)
self.new_blip_id = self.properties['newBlipId']
self.new_blip = wavelet.blips.get(self.new_blip_id)
class WaveletBlipRemoved(Event):
"""Event triggered when a new blip is removed.
Attributes:
removed_blip_id: the id of the removed blip
removed_blip: if in context, the removed blip
"""
type = 'WAVELET_BLIP_REMOVED'
def __init__(self, json, wavelet):
super(WaveletBlipRemoved, self).__init__(json, wavelet)
self.removed_blip_id = self.properties['removedBlipId']
self.removed_blip = wavelet.blips.get(self.removed_blip_id)
class WaveletParticipantsChanged(Event):
"""Event triggered when the participants on a wave change.
Attributes:
participants_added: List of participants added.
participants_removed: List of participants removed.
"""
type = 'WAVELET_PARTICIPANTS_CHANGED'
def __init__(self, json, wavelet):
super(WaveletParticipantsChanged, self).__init__(json, wavelet)
self.participants_added = self.properties['participantsAdded']
self.participants_removed = self.properties['participantsRemoved']
class WaveletSelfAdded(Event):
"""Event triggered when the robot is added to the wavelet."""
type = 'WAVELET_SELF_ADDED'
class WaveletSelfRemoved(Event):
"""Event triggered when the robot is removed from the wavelet."""
type = 'WAVELET_SELF_REMOVED'
class WaveletTitleChanged(Event):
"""Event triggered when the title of the wavelet has changed.
Attributes:
title: The new title.
"""
type = 'WAVELET_TITLE_CHANGED'
def __init__(self, json, wavelet):
super(WaveletTitleChanged, self).__init__(json, wavelet)
self.title = self.properties['title']
class BlipContributorsChanged(Event):
"""Event triggered when the contributors to this blip change.
Attributes:
contributors_added: List of contributors that were added.
contributors_removed: List of contributors that were removed.
"""
type = 'BLIP_CONTRIBUTORS_CHANGED'
def __init__(self, json, wavelet):
super(BlipContributorsChanged, self).__init__(json, wavelet)
self.contibutors_added = self.properties['contributorsAdded']
self.contibutors_removed = self.properties['contributorsRemoved']
class BlipSubmitted(Event):
"""Event triggered when a blip is submitted."""
type = 'BLIP_SUBMITTED'
class DocumentChanged(Event):
"""Event triggered when a document is changed.
This event is fired after any changes in the document and should be used
carefully to keep the amount of traffic to the robot reasonable. Use
filters where appropriate.
"""
type = 'DOCUMENT_CHANGED'
class FormButtonClicked(Event):
"""Event triggered when a form button is clicked.
Attributes:
button_name: The name of the button that was clicked.
"""
type = 'FORM_BUTTON_CLICKED'
def __init__(self, json, wavelet):
super(FormButtonClicked, self).__init__(json, wavelet)
self.button_name = self.properties['buttonName']
class GadgetStateChanged(Event):
"""Event triggered when the state of a gadget changes.
Attributes:
index: The index of the gadget that changed in the document.
old_state: The old state of the gadget.
"""
type = 'GADGET_STATE_CHANGED'
def __init__(self, json, wavelet):
super(GadgetStateChanged, self).__init__(json, wavelet)
self.index = self.properties['index']
self.old_state = self.properties['oldState']
class AnnotatedTextChanged(Event):
"""Event triggered when text with an annotation has changed.
This is mainly useful in combination with a filter on the
name of the annotation.
Attributes:
name: The name of the annotation.
value: The value of the annotation that changed.
"""
type = 'ANNOTATED_TEXT_CHANGED'
def __init__(self, json, wavelet):
super(AnnotatedTextChanged, self).__init__(json, wavelet)
self.name = self.properties['name']
self.value = self.properties.get('value')
class OperationError(Event):
"""Triggered when an event on the server occurred.
Attributes:
operation_id: The operation id of the failing operation.
error_message: More information as to what went wrong.
"""
type = 'OPERATION_ERROR'
def __init__(self, json, wavelet):
super(OperationError, self).__init__(json, wavelet)
self.operation_id = self.properties['operationId']
self.error_message = self.properties['message']
class WaveletCreated(Event):
"""Triggered when a new wavelet is created.
This event is only triggered if the robot creates a new
wavelet and can be used to initialize the newly created wave.
wavelets created by other participants remain invisible
to the robot until the robot is added to the wave in
which case WaveletSelfAdded is triggered.
Attributes:
message: Whatever string was passed into the new_wave
call as message (if any).
"""
type = 'WAVELET_CREATED'
def __init__(self, json, wavelet):
super(WaveletCreated, self).__init__(json, wavelet)
self.message = self.properties['message']
class WaveletFetched(Event):
"""Triggered when a new wavelet is fetched.
This event is triggered after a robot requests to
see another wavelet. The robot has to be on the other
wavelet already.
Attributes:
message: Whatever string was passed into the new_wave
call as message (if any).
"""
type = 'WAVELET_FETCHED'
def __init__(self, json, wavelet):
super(WaveletFetched, self).__init__(json, wavelet)
self.message = self.properties['message']
class WaveletTagsChanged(Event):
"""Event triggered when the tags on a wavelet change."""
type = 'WAVELET_TAGS_CHANGED'
def __init__(self, json, wavelet):
super(WaveletTagsChanged, self).__init__(json, wavelet)
def is_event(cls):
"""Returns whether the passed class is an event."""
try:
if not issubclass(cls, Event):
return False
return hasattr(cls, 'type')
except TypeError:
return False
ALL = [item for item in globals().copy().values() if is_event(item)]
| ajibawa-2023/Python-Code-Large/train/row_1131 | 119 | 301 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 22], "level": 0, "parent": null, "vector": [8, 0, 0.0648, 0.0199, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Defines event types that are sent from the wave server.\n\nThis module defines all of the event types currently supported by the wave\nserver. Each event type is sub classed from Event and has its own\nproperties depending on the type.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "label": "Context", "type": "class", "loc": [25, 39], "level": 0, "parent": null, "vector": [3, 0, 0.1063, 0.0498, 0, 0.66, 0.05, 560, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "Context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Context(object):\n \"\"\"Specifies constants representing different context requests.\"\"\"\n\n #: Requests the root blip.\n ROOT = 'ROOT'\n #: Requests the parent blip of the event blip.\n PARENT = 'PARENT'\n #: Requests the siblings blip of the event blip."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L26_C2", "label": "expression", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [8, 1, 0.0864, 0.0033, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Specifies constants representing different context requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L29_C2", "label": "ROOT =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.0963, 0.0033, 1, 0.64, 0.1667, 986, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROOT = 'ROOT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L31_C2", "label": "PARENT =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.103, 0.0033, 1, 0.64, 0.3333, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PARENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PARENT = 'PARENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L33_C2", "label": "SIBLINGS =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.1096, 0.0033, 1, 0.64, 0.5, 912, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIBLINGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SIBLINGS = 'SIBLINGS'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L35_C2", "label": "CHILDREN =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.1163, 0.0033, 1, 0.64, 0.6667, 404, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CHILDREN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CHILDREN = 'CHILDREN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L37_C2", "label": "SELF =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.1229, 0.0033, 1, 0.64, 0.8333, 296, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SELF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SELF = 'SELF'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L39_C2", "label": "ALL =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "vector": [14, 1, 0.1296, 0.0033, 1, 0.64, 1.0, 431, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALL = 'ALL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L42_C0", "label": "Event", "type": "class", "loc": [42, 78], "level": 0, "parent": null, "vector": [3, 0, 0.1993, 0.1229, 0, 0.66, 0.1, 9, 0, 1, 0, 0, 186, 0, 7], "semantic": {"name": "Event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Event(object):\n \"\"\"Object describing a single event.\n\n Attributes:\n modified_by: Participant id that caused this event.\n\n timestamp: Timestamp that this event occurred on the server.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L43_C2", "label": "expression", "type": "expression", "loc": [43, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L42_C0", "vector": [8, 1, 0.1761, 0.0698, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Object describing a single event.\n\n Attributes:\n modified_by: Participant id that caused this event.\n\n timestamp: Timestamp that this event occurred on the server.\n\n type: Type string of this event."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "label": "__init__", "type": "function", "loc": [65, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L42_C0", "vector": [2, 1, 0.2375, 0.0465, 1, 0.2, 1.0, 555, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n \"\"\"Inits this event with JSON data.\n\n Args:\n json: JSON data from Wave server.\n \"\"\"\n self.modified_by = json.get('modifiedBy')\n self.timestamp = json.get('timestamp', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L66_C4", "label": "expression", "type": "expression", "loc": [66, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [8, 2, 0.2259, 0.0166, 2, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this event with JSON data.\n\n Args:\n json: JSON data from Wave server.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L71_C4", "label": "self.modified_by = get()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2359, 0.0033, 2, 0.6, 0.125, 212, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.modified_by", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.modified_by = json.get('modifiedBy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L72_C4", "label": "self.timestamp = get()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2392, 0.0033, 2, 0.6, 0.25, 297, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self.timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.timestamp = json.get('timestamp', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L73_C4", "label": "self.type = get()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2425, 0.0033, 2, 0.6, 0.375, 398, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.type", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.type = json.get('type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L74_C4", "label": "self.raw_data =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2458, 0.0033, 2, 0.6, 0.5, 25, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L75_C4", "label": "self.properties = get()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2492, 0.0033, 2, 0.6, 0.625, 48, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self.properties", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.properties = json.get('properties', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L76_C4", "label": "self.blip_id = get()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2525, 0.0033, 2, 0.6, 0.75, 149, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.blip_id = self.properties.get('blipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L77_C4", "label": "self.blip = get()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2558, 0.0033, 2, 0.6, 0.875, 949, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.blip = wavelet.blips.get(self.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L78_C4", "label": "self.proxying_for = get()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "vector": [14, 2, 0.2591, 0.0033, 2, 0.6, 1.0, 267, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.proxying_for", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.proxying_for = json.get('proxyingFor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "label": "WaveletBlipCreated", "type": "class", "loc": [80, 93], "level": 0, "parent": null, "vector": [3, 0, 0.2874, 0.0465, 0, 0.66, 0.15, 762, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "WaveletBlipCreated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletBlipCreated(Event):\n \"\"\"Event triggered when a new blip is created.\n\n Attributes:\n new_blip_id: The id of the newly created blip.\n\n new_blip: If in context, the actual new blip.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L81_C2", "label": "expression", "type": "expression", "loc": [81, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "vector": [8, 1, 0.2791, 0.0233, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a new blip is created.\n\n Attributes:\n new_blip_id: The id of the newly created blip.\n\n new_blip: If in context, the actual new blip.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L88_C2", "label": "type =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "vector": [14, 1, 0.2924, 0.0033, 1, 0.53, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_BLIP_CREATED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "label": "__init__", "type": "function", "loc": [90, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "vector": [2, 1, 0.304, 0.0133, 1, 0.53, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletBlipCreated, self).__init__(json, wavelet)\n self.new_blip_id = self.properties['newBlipId']\n self.new_blip = wavelet.blips.get(self.new_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L91_C4", "label": "__init__()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "vector": [8, 2, 0.3023, 0.0033, 2, 0.39, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletBlipCreated, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L92_C4", "label": "self.new_blip_id =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "vector": [14, 2, 0.3056, 0.0033, 2, 0.39, 0.5, 631, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.new_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.new_blip_id = self.properties['newBlipId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L93_C4", "label": "self.new_blip = get()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "vector": [14, 2, 0.309, 0.0033, 2, 0.39, 1.0, 463, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.new_blip = wavelet.blips.get(self.new_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "label": "WaveletBlipRemoved", "type": "class", "loc": [96, 109], "level": 0, "parent": null, "vector": [3, 0, 0.3405, 0.0465, 0, 0.66, 0.2, 618, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "WaveletBlipRemoved", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletBlipRemoved(Event):\n \"\"\"Event triggered when a new blip is removed.\n\n Attributes:\n removed_blip_id: the id of the removed blip\n\n removed_blip: if in context, the removed blip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L97_C2", "label": "expression", "type": "expression", "loc": [97, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "vector": [8, 1, 0.3322, 0.0233, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a new blip is removed.\n\n Attributes:\n removed_blip_id: the id of the removed blip\n\n removed_blip: if in context, the removed blip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L104_C2", "label": "type =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "vector": [14, 1, 0.3455, 0.0033, 1, 0.43, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_BLIP_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "label": "__init__", "type": "function", "loc": [106, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "vector": [2, 1, 0.3571, 0.0133, 1, 0.43, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletBlipRemoved, self).__init__(json, wavelet)\n self.removed_blip_id = self.properties['removedBlipId']\n self.removed_blip = wavelet.blips.get(self.removed_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L107_C4", "label": "__init__()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "vector": [8, 2, 0.3555, 0.0033, 2, 0.17, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletBlipRemoved, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L108_C4", "label": "self.removed_blip_id =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "vector": [14, 2, 0.3588, 0.0033, 2, 0.17, 0.5, 936, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.removed_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.removed_blip_id = self.properties['removedBlipId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L109_C4", "label": "self.removed_blip = get()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "vector": [14, 2, 0.3621, 0.0033, 2, 0.17, 1.0, 946, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.removed_blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.removed_blip = wavelet.blips.get(self.removed_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "label": "WaveletParticipantsChanged", "type": "class", "loc": [112, 125], "level": 0, "parent": null, "vector": [3, 0, 0.3937, 0.0465, 0, 0.66, 0.25, 1, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletParticipantsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletParticipantsChanged(Event):\n \"\"\"Event triggered when the participants on a wave change.\n\n Attributes:\n participants_added: List of participants added.\n\n participants_removed: List of participants removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L113_C2", "label": "expression", "type": "expression", "loc": [113, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "vector": [8, 1, 0.3854, 0.0233, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the participants on a wave change.\n\n Attributes:\n participants_added: List of participants added.\n\n participants_removed: List of participants removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L120_C2", "label": "type =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "vector": [14, 1, 0.3987, 0.0033, 1, 0.96, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_PARTICIPANTS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "label": "__init__", "type": "function", "loc": [122, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "vector": [2, 1, 0.4103, 0.0133, 1, 0.96, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletParticipantsChanged, self).__init__(json, wavelet)\n self.participants_added = self.properties['participantsAdded']\n self.participants_removed = self.properties['participantsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L123_C4", "label": "__init__()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "vector": [8, 2, 0.4086, 0.0033, 2, 0.9, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletParticipantsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L124_C4", "label": "self.participants_added =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "vector": [14, 2, 0.412, 0.0033, 2, 0.9, 0.5, 40, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.participants_added", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.participants_added = self.properties['participantsAdded']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L125_C4", "label": "self.participants_removed =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "vector": [14, 2, 0.4153, 0.0033, 2, 0.9, 1.0, 763, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.participants_removed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.participants_removed = self.properties['participantsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L128_C0", "label": "WaveletSelfAdded", "type": "class", "loc": [128, 130], "level": 0, "parent": null, "vector": [3, 0, 0.4286, 0.01, 0, 0.66, 0.3, 757, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "WaveletSelfAdded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletSelfAdded(Event):\n \"\"\"Event triggered when the robot is added to the wavelet.\"\"\"\n type = 'WAVELET_SELF_ADDED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L129_C2", "label": "expression", "type": "expression", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L128_C0", "vector": [8, 1, 0.4286, 0.0033, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the robot is added to the wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L130_C2", "label": "type =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L128_C0", "vector": [14, 1, 0.4319, 0.0033, 1, 0.06, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_SELF_ADDED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L133_C0", "label": "WaveletSelfRemoved", "type": "class", "loc": [133, 135], "level": 0, "parent": null, "vector": [3, 0, 0.4452, 0.01, 0, 0.66, 0.35, 823, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "WaveletSelfRemoved", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletSelfRemoved(Event):\n \"\"\"Event triggered when the robot is removed from the wavelet.\"\"\"\n type = 'WAVELET_SELF_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L134_C2", "label": "expression", "type": "expression", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L133_C0", "vector": [8, 1, 0.4452, 0.0033, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the robot is removed from the wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L135_C2", "label": "type =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L133_C0", "vector": [14, 1, 0.4485, 0.0033, 1, 0.59, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_SELF_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "label": "WaveletTitleChanged", "type": "class", "loc": [138, 148], "level": 0, "parent": null, "vector": [3, 0, 0.4751, 0.0365, 0, 0.66, 0.4, 196, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletTitleChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletTitleChanged(Event):\n \"\"\"Event triggered when the title of the wavelet has changed.\n\n Attributes:\n title: The new title.\n \"\"\"\n type = 'WAVELET_TITLE_CHANGED'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L139_C2", "label": "expression", "type": "expression", "loc": [139, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "vector": [8, 1, 0.4684, 0.0166, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the title of the wavelet has changed.\n\n Attributes:\n title: The new title.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L144_C2", "label": "type =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "vector": [14, 1, 0.4784, 0.0033, 1, 0.41, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_TITLE_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2", "label": "__init__", "type": "function", "loc": [146, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "vector": [2, 1, 0.4884, 0.01, 1, 0.41, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletTitleChanged, self).__init__(json, wavelet)\n self.title = self.properties['title']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L147_C4", "label": "__init__()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2", "vector": [8, 2, 0.4884, 0.0033, 2, 0.13, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletTitleChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L148_C4", "label": "self.title =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2", "vector": [14, 2, 0.4917, 0.0033, 2, 0.13, 1.0, 629, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.title = self.properties['title']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "label": "BlipContributorsChanged", "type": "class", "loc": [151, 164], "level": 0, "parent": null, "vector": [3, 0, 0.5233, 0.0465, 0, 0.66, 0.45, 475, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "BlipContributorsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipContributorsChanged(Event):\n \"\"\"Event triggered when the contributors to this blip change.\n\n Attributes:\n contributors_added: List of contributors that were added.\n\n contributors_removed: List of contributors that were removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L152_C2", "label": "expression", "type": "expression", "loc": [152, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "vector": [8, 1, 0.515, 0.0233, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the contributors to this blip change.\n\n Attributes:\n contributors_added: List of contributors that were added.\n\n contributors_removed: List of contributors that were removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L159_C2", "label": "type =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "vector": [14, 1, 0.5282, 0.0033, 1, 0.42, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'BLIP_CONTRIBUTORS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "label": "__init__", "type": "function", "loc": [161, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "vector": [2, 1, 0.5399, 0.0133, 1, 0.42, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(BlipContributorsChanged, self).__init__(json, wavelet)\n self.contibutors_added = self.properties['contributorsAdded']\n self.contibutors_removed = self.properties['contributorsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L162_C4", "label": "__init__()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "vector": [8, 2, 0.5382, 0.0033, 2, 0.2, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(BlipContributorsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L163_C4", "label": "self.contibutors_added =", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "vector": [14, 2, 0.5415, 0.0033, 2, 0.2, 0.5, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.contibutors_added", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.contibutors_added = self.properties['contributorsAdded']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L164_C4", "label": "self.contibutors_removed =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "vector": [14, 2, 0.5449, 0.0033, 2, 0.2, 1.0, 291, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.contibutors_removed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.contibutors_removed = self.properties['contributorsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L167_C0", "label": "BlipSubmitted", "type": "class", "loc": [167, 169], "level": 0, "parent": null, "vector": [3, 0, 0.5581, 0.01, 0, 0.66, 0.5, 150, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "BlipSubmitted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipSubmitted(Event):\n \"\"\"Event triggered when a blip is submitted.\"\"\"\n type = 'BLIP_SUBMITTED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L168_C2", "label": "expression", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L167_C0", "vector": [8, 1, 0.5581, 0.0033, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a blip is submitted.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L169_C2", "label": "type =", "type": "assigned_variable", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L167_C0", "vector": [14, 1, 0.5615, 0.0033, 1, 0.73, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'BLIP_SUBMITTED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L172_C0", "label": "DocumentChanged", "type": "class", "loc": [172, 179], "level": 0, "parent": null, "vector": [3, 0, 0.5831, 0.0266, 0, 0.66, 0.55, 123, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "DocumentChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DocumentChanged(Event):\n \"\"\"Event triggered when a document is changed.\n\n This event is fired after any changes in the document and should be used\n carefully to keep the amount of traffic to the robot reasonable. Use\n filters where appropriate.\n \"\"\"\n type = 'DOCUMENT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L173_C2", "label": "expression", "type": "expression", "loc": [173, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L172_C0", "vector": [8, 1, 0.5831, 0.0199, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a document is changed.\n\n This event is fired after any changes in the document and should be used\n carefully to keep the amount of traffic to the robot reasonable. Use\n filters where appropriate.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L179_C2", "label": "type =", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L172_C0", "vector": [14, 1, 0.5947, 0.0033, 1, 0.44, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'DOCUMENT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "label": "FormButtonClicked", "type": "class", "loc": [182, 192], "level": 0, "parent": null, "vector": [3, 0, 0.6213, 0.0365, 0, 0.66, 0.6, 639, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "FormButtonClicked", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FormButtonClicked(Event):\n \"\"\"Event triggered when a form button is clicked.\n\n Attributes:\n button_name: The name of the button that was clicked.\n \"\"\"\n type = 'FORM_BUTTON_CLICKED'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L183_C2", "label": "expression", "type": "expression", "loc": [183, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "vector": [8, 1, 0.6146, 0.0166, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a form button is clicked.\n\n Attributes:\n button_name: The name of the button that was clicked.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L188_C2", "label": "type =", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "vector": [14, 1, 0.6246, 0.0033, 1, 0.51, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'FORM_BUTTON_CLICKED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2", "label": "__init__", "type": "function", "loc": [190, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "vector": [2, 1, 0.6346, 0.01, 1, 0.51, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(FormButtonClicked, self).__init__(json, wavelet)\n self.button_name = self.properties['buttonName']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L191_C4", "label": "__init__()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2", "vector": [8, 2, 0.6346, 0.0033, 2, 0.08, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(FormButtonClicked, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L192_C4", "label": "self.button_name =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2", "vector": [14, 2, 0.6379, 0.0033, 2, 0.08, 1.0, 833, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.button_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.button_name = self.properties['buttonName']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "label": "GadgetStateChanged", "type": "class", "loc": [195, 208], "level": 0, "parent": null, "vector": [3, 0, 0.6694, 0.0465, 0, 0.66, 0.65, 393, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "GadgetStateChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GadgetStateChanged(Event):\n \"\"\"Event triggered when the state of a gadget changes.\n\n Attributes:\n index: The index of the gadget that changed in the document.\n\n old_state: The old state of the gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L196_C2", "label": "expression", "type": "expression", "loc": [196, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "vector": [8, 1, 0.6611, 0.0233, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the state of a gadget changes.\n\n Attributes:\n index: The index of the gadget that changed in the document.\n\n old_state: The old state of the gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L203_C2", "label": "type =", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "vector": [14, 1, 0.6744, 0.0033, 1, 0.42, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'GADGET_STATE_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "label": "__init__", "type": "function", "loc": [205, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "vector": [2, 1, 0.686, 0.0133, 1, 0.42, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(GadgetStateChanged, self).__init__(json, wavelet)\n self.index = self.properties['index']\n self.old_state = self.properties['oldState']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L206_C4", "label": "__init__()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "vector": [8, 2, 0.6844, 0.0033, 2, 0.68, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GadgetStateChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L207_C4", "label": "self.index =", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "vector": [14, 2, 0.6877, 0.0033, 2, 0.68, 0.5, 777, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.index = self.properties['index']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L208_C4", "label": "self.old_state =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "vector": [14, 2, 0.691, 0.0033, 2, 0.68, 1.0, 730, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.old_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.old_state = self.properties['oldState']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "label": "AnnotatedTextChanged", "type": "class", "loc": [211, 227], "level": 0, "parent": null, "vector": [3, 0, 0.7276, 0.0565, 0, 0.66, 0.7, 886, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "AnnotatedTextChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AnnotatedTextChanged(Event):\n \"\"\"Event triggered when text with an annotation has changed.\n\n This is mainly useful in combination with a filter on the\n name of the annotation.\n\n Attributes:\n name: The name of the annotation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L212_C2", "label": "expression", "type": "expression", "loc": [212, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "vector": [8, 1, 0.7193, 0.0332, 1, 0.1, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when text with an annotation has changed.\n\n This is mainly useful in combination with a filter on the\n name of the annotation.\n\n Attributes:\n name: The name of the annotation.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L222_C2", "label": "type =", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "vector": [14, 1, 0.7375, 0.0033, 1, 0.1, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'ANNOTATED_TEXT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "label": "__init__", "type": "function", "loc": [224, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "vector": [2, 1, 0.7492, 0.0133, 1, 0.1, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(AnnotatedTextChanged, self).__init__(json, wavelet)\n self.name = self.properties['name']\n self.value = self.properties.get('value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L225_C4", "label": "__init__()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "vector": [8, 2, 0.7475, 0.0033, 2, 0.54, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(AnnotatedTextChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L226_C4", "label": "self.name =", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "vector": [14, 2, 0.7508, 0.0033, 2, 0.54, 0.5, 689, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = self.properties['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L227_C4", "label": "self.value = get()", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "vector": [14, 2, 0.7542, 0.0033, 2, 0.54, 1.0, 966, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.value = self.properties.get('value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "label": "OperationError", "type": "class", "loc": [230, 243], "level": 0, "parent": null, "vector": [3, 0, 0.7857, 0.0465, 0, 0.66, 0.75, 796, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "OperationError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OperationError(Event):\n \"\"\"Triggered when an event on the server occurred.\n\n Attributes:\n operation_id: The operation id of the failing operation.\n\n error_message: More information as to what went wrong.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L231_C2", "label": "expression", "type": "expression", "loc": [231, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "vector": [8, 1, 0.7774, 0.0233, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when an event on the server occurred.\n\n Attributes:\n operation_id: The operation id of the failing operation.\n\n error_message: More information as to what went wrong.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L238_C2", "label": "type =", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "vector": [14, 1, 0.7907, 0.0033, 1, 0.9, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'OPERATION_ERROR'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "label": "__init__", "type": "function", "loc": [240, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "vector": [2, 1, 0.8023, 0.0133, 1, 0.9, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(OperationError, self).__init__(json, wavelet)\n self.operation_id = self.properties['operationId']\n self.error_message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L241_C4", "label": "__init__()", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "vector": [8, 2, 0.8007, 0.0033, 2, 0.96, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(OperationError, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L242_C4", "label": "self.operation_id =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "vector": [14, 2, 0.804, 0.0033, 2, 0.96, 0.5, 783, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.operation_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.operation_id = self.properties['operationId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L243_C4", "label": "self.error_message =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "vector": [14, 2, 0.8073, 0.0033, 2, 0.96, 1.0, 96, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.error_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.error_message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "label": "WaveletCreated", "type": "class", "loc": [246, 263], "level": 0, "parent": null, "vector": [3, 0, 0.8455, 0.0598, 0, 0.66, 0.8, 391, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletCreated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletCreated(Event):\n \"\"\"Triggered when a new wavelet is created.\n\n This event is only triggered if the robot creates a new\n wavelet and can be used to initialize the newly created wave.\n wavelets created by other participants remain invisible\n to the robot until the robot is added to the wave in\n which case WaveletSelfAdded is triggered."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L247_C2", "label": "expression", "type": "expression", "loc": [247, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "vector": [8, 1, 0.8389, 0.0399, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when a new wavelet is created.\n\n This event is only triggered if the robot creates a new\n wavelet and can be used to initialize the newly created wave.\n wavelets created by other participants remain invisible\n to the robot until the robot is added to the wave in\n which case WaveletSelfAdded is triggered.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L259_C2", "label": "type =", "type": "assigned_variable", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "vector": [14, 1, 0.8605, 0.0033, 1, 0.43, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_CREATED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2", "label": "__init__", "type": "function", "loc": [261, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "vector": [2, 1, 0.8704, 0.01, 1, 0.43, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletCreated, self).__init__(json, wavelet)\n self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L262_C4", "label": "__init__()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2", "vector": [8, 2, 0.8704, 0.0033, 2, 0.07, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletCreated, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L263_C4", "label": "self.message =", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2", "vector": [14, 2, 0.8738, 0.0033, 2, 0.07, 1.0, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "label": "WaveletFetched", "type": "class", "loc": [266, 281], "level": 0, "parent": null, "vector": [3, 0, 0.9086, 0.0532, 0, 0.66, 0.85, 429, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletFetched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletFetched(Event):\n \"\"\"Triggered when a new wavelet is fetched.\n\n This event is triggered after a robot requests to\n see another wavelet. The robot has to be on the other\n wavelet already.\n\n Attributes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L267_C2", "label": "expression", "type": "expression", "loc": [267, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "vector": [8, 1, 0.902, 0.0332, 1, 0.96, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when a new wavelet is fetched.\n\n This event is triggered after a robot requests to\n see another wavelet. The robot has to be on the other\n wavelet already.\n\n Attributes:\n message: Whatever string was passed into the new_wave"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L277_C2", "label": "type =", "type": "assigned_variable", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "vector": [14, 1, 0.9203, 0.0033, 1, 0.96, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_FETCHED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2", "label": "__init__", "type": "function", "loc": [279, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "vector": [2, 1, 0.9302, 0.01, 1, 0.96, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletFetched, self).__init__(json, wavelet)\n self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L280_C4", "label": "__init__()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2", "vector": [8, 2, 0.9302, 0.0033, 2, 0.91, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletFetched, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L281_C4", "label": "self.message =", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2", "vector": [14, 2, 0.9336, 0.0033, 2, 0.91, 1.0, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "label": "WaveletTagsChanged", "type": "class", "loc": [284, 289], "level": 0, "parent": null, "vector": [3, 0, 0.9518, 0.0199, 0, 0.66, 0.9, 141, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletTagsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletTagsChanged(Event):\n \"\"\"Event triggered when the tags on a wavelet change.\"\"\"\n type = 'WAVELET_TAGS_CHANGED'\n\n def __init__(self, json, wavelet):\n super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L285_C2", "label": "expression", "type": "expression", "loc": [285, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "vector": [8, 1, 0.9468, 0.0033, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the tags on a wavelet change.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L286_C2", "label": "type =", "type": "assigned_variable", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "vector": [14, 1, 0.9502, 0.0033, 1, 0.99, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_TAGS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L288_C2", "label": "__init__", "type": "function", "loc": [288, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "vector": [2, 1, 0.9585, 0.0066, 1, 0.99, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L289_C4", "label": "__init__()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L288_C2", "vector": [8, 2, 0.9601, 0.0033, 2, 0.04, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L292_C0", "label": "is_event", "type": "function", "loc": [292, 299], "level": 0, "parent": null, "vector": [2, 0, 0.9817, 0.0266, 0, 0.66, 0.95, 63, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_event", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_event(cls):\n \"\"\"Returns whether the passed class is an event.\"\"\"\n try:\n if not issubclass(cls, Event):\n return False\n return hasattr(cls, 'type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L293_C2", "label": "expression", "type": "expression", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L292_C0", "vector": [8, 1, 0.9734, 0.0033, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns whether the passed class is an event.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "label": "try", "type": "try", "loc": [294, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L292_C0", "vector": [7, 1, 0.985, 0.0199, 1, 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 if not issubclass(cls, Event):\n return False\n return hasattr(cls, 'type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:If_L295_C4", "label": "if", "type": "if", "loc": [295, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "vector": [4, 2, 0.9817, 0.0066, 2, 0.81, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not issubclass(cls, Event):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Return_L296_C6", "label": "return", "type": "return", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:If_L295_C4", "vector": [13, 3, 0.9834, 0.0033, 3, 0.58, 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_1131:Return_L297_C4", "label": "return", "type": "return", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "vector": [13, 2, 0.9867, 0.0033, 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 hasattr(cls, 'type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1131:Return_L299_C4", "label": "return", "type": "return", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "vector": [13, 2, 0.9934, 0.0033, 2, 0.81, 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_1131:Assign_L301_C0", "label": "ALL =", "type": "assigned_variable", "loc": [301, 301], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0033, 0, 0.66, 1.0, 431, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ALL = [item for item in globals().copy().values() if is_event(item)]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L159_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L169_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L173_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L179_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L183_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L203_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L238_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L247_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L259_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L277_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L285_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Assign_L286_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L288_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L288_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Expr_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:FunctionDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:If_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:If_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Return_L296_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Return_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1131:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1131:Return_L299_C4"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import element
import errors
import util
class Annotation(object):
"""Models an annotation on a document.
Annotations are key/value pairs over a range of content. Annotations
can be used to store data or to be interpreted by a client when displaying
the data.
"""
# Use the following constants to control the display of the client
#: Reserved annotation for setting background color of text.
BACKGROUND_COLOR = "style/backgroundColor"
#: Reserved annotation for setting color of text.
COLOR = "style/color"
#: Reserved annotation for setting font family of text.
FONT_FAMILY = "style/fontFamily"
#: Reserved annotation for setting font family of text.
FONT_SIZE = "style/fontSize"
#: Reserved annotation for setting font style of text.
FONT_STYLE = "style/fontStyle"
#: Reserved annotation for setting font weight of text.
FONT_WEIGHT = "style/fontWeight"
#: Reserved annotation for setting text decoration.
TEXT_DECORATION = "style/textDecoration"
#: Reserved annotation for setting vertical alignment.
VERTICAL_ALIGN = "style/verticalAlign"
def __init__(self, name, value, start, end):
self._name = name
self._value = value
self._start = start
self._end = end
@property
def name(self):
return self._name
@property
def value(self):
return self._value
@property
def start(self):
return self._start
@property
def end(self):
return self._end
def _shift(self, where, inc):
"""Shift annotation by 'inc' if it (partly) overlaps with 'where'."""
if self._start >= where:
self._start += inc
if self._end >= where:
self._end += inc
def serialize(self):
"""Serializes the annotation.
Returns:
A dict containing the name, value, and range values.
"""
return {'name': self._name,
'value': self._value,
'range': {'start': self._start,
'end': self._end}}
class Annotations(object):
"""A dictionary-like object containing the annotations, keyed by name."""
def __init__(self, operation_queue, blip):
self._operation_queue = operation_queue
self._blip = blip
self._store = {}
def __contains__(self, what):
if isinstance(what, Annotation):
what = what.name
return what in self._store
def _add_internal(self, name, value, start, end):
"""Internal add annotation does not send out operations."""
if name in self._store:
# TODO: use bisect to make this more efficient.
new_list = []
for existing in self._store[name]:
if start > existing.end or end < existing.start:
new_list.append(existing)
else:
if existing.value == value:
# merge the annotations:
start = min(existing.start, start)
end = max(existing.end, end)
else:
# chop the bits off the existing annotation
if existing.start < start:
new_list.append(Annotation(
existing.name, existing.value, existing.start, start))
if existing.end > end:
new_list.append(Annotation(
existing.name, existing.value, existing.end, end))
new_list.append(Annotation(name, value, start, end))
self._store[name] = new_list
else:
self._store[name] = [Annotation(name, value, start, end)]
def _delete_internal(self, name, start=0, end=-1):
"""Remove the passed annotaion from the internal representation."""
if not name in self._store:
return
if end < 0:
end = len(self._blip) + end
new_list = []
for a in self._store[name]:
if start > a.end or end < a.start:
new_list.append(a)
elif start < a.start and end > a.end:
continue
else:
if a.start < start:
new_list.append(Annotation(name, a.value, a.start, start))
if a.end > end:
new_list.append(Annotation(name, a.value, end, a.end))
if new_list:
self._store[name] = new_list
else:
del self._store[name]
def _shift(self, where, inc):
"""Shift annotation by 'inc' if it (partly) overlaps with 'where'."""
for annotations in self._store.values():
for annotation in annotations:
annotation._shift(where, inc)
# Merge fragmented annotations that should be contiguous, for example:
# Annotation('foo', 'bar', 1, 2) and Annotation('foo', 'bar', 2, 3).
for name, annotations in self._store.items():
new_list = []
for i, annotation in enumerate(annotations):
name = annotation.name
value = annotation.value
start = annotation.start
end = annotation.end
# Find the last end index.
for j, next_annotation in enumerate(annotations[i + 1:]):
# Not contiguous, skip.
if (end < next_annotation.start):
break
# Contiguous, merge.
if (end == next_annotation.start and value == next_annotation.value):
end = next_annotation.end
del annotations[j]
new_list.append(Annotation(name, value, start, end))
self._store[name] = new_list
def __len__(self):
return len(self._store)
def __getitem__(self, key):
return self._store[key]
def __iter__(self):
for l in self._store.values():
for ann in l:
yield ann
def names(self):
"""Return the names of the annotations in the store."""
return self._store.keys()
def serialize(self):
"""Return a list of the serialized annotations."""
res = []
for v in self._store.values():
res += [a.serialize() for a in v]
return res
class Blips(object):
"""A dictionary-like object containing the blips, keyed on blip ID."""
def __init__(self, blips):
self._blips = blips
def __getitem__(self, blip_id):
return self._blips[blip_id]
def __iter__(self):
return self._blips.__iter__()
def __len__(self):
return len(self._blips)
def _add(self, ablip):
self._blips[ablip.blip_id] = ablip
def _remove_with_id(self, blip_id):
del_blip = self._blips[blip_id]
if del_blip:
# Remove the reference to this blip from its parent.
parent_blip = self._blips[blip_id].parent_blip
if parent_blip:
parent_blip._child_blip_ids.remove(blip_id)
del self._blips[blip_id]
def get(self, blip_id, default_value=None):
"""Retrieves a blip.
Returns:
A Blip object. If none found for the ID, it returns None,
or if default_value is specified, it returns that.
"""
return self._blips.get(blip_id, default_value)
def serialize(self):
"""Serializes the blips.
Returns:
A dict of serialized blips.
"""
res = {}
for blip_id, item in self._blips.items():
res[blip_id] = item.serialize()
return res
class BlipRefs(object):
"""Represents a set of references to contents in a blip.
For example, a BlipRefs instance can represent the results
of a search, an explicitly set range, a regular expression,
or refer to the entire blip. BlipRefs are used to express
operations on a blip in a consistent way that can easily
be transfered to the server.
The typical way of creating a BlipRefs object is to use
selector methods on the Blip object. Developers will not
usually instantiate a BlipRefs object directly.
"""
DELETE = 'DELETE'
REPLACE = 'REPLACE'
INSERT = 'INSERT'
INSERT_AFTER = 'INSERT_AFTER'
ANNOTATE = 'ANNOTATE'
CLEAR_ANNOTATION = 'CLEAR_ANNOTATION'
UPDATE_ELEMENT = 'UPDATE_ELEMENT'
def __init__(self, blip, maxres=1):
self._blip = blip
self._maxres = maxres
@classmethod
def all(cls, blip, findwhat, maxres=-1, **restrictions):
"""Construct an instance representing the search for text or elements."""
obj = cls(blip, maxres)
obj._findwhat = findwhat
obj._restrictions = restrictions
obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)
if findwhat is None:
# No findWhat, take the entire blip
obj._params = {}
else:
query = {'maxRes': maxres}
if isinstance(findwhat, basestring):
query['textMatch'] = findwhat
else:
query['elementMatch'] = findwhat.class_type
query['restrictions'] = restrictions
obj._params = {'modifyQuery': query}
return obj
@classmethod
def range(cls, blip, begin, end):
"""Constructs an instance representing an explicitly set range."""
obj = cls(blip)
obj._begin = begin
obj._end = end
obj._hits = lambda: [(begin, end)]
obj._params = {'range': {'start': begin, 'end': end}}
return obj
def _elem_matches(self, elem, clz, **restrictions):
if not isinstance(elem, clz):
return False
for key, val in restrictions.items():
if getattr(elem, key) != val:
return False
return True
def _find(self, what, maxres=-1, **restrictions):
"""Iterates where 'what' occurs in the associated blip.
What can be either a string or a class reference.
Examples:
self._find('hello') will return the first occurence of the word hello
self._find(element.Gadget, url='http://example.com/gadget.xml')
will return the first gadget that has as url example.com.
Args:
what: what to search for. Can be a class or a string. The class
should be an element from element.py
maxres: number of results to return at most, or <= 0 for all.
restrictions: if what specifies a class, further restrictions
of the found instances.
Yields:
Tuples indicating the range of the matches. For a one
character/element match at position x, (x, x+1) is yielded.
"""
blip = self._blip
if what is None:
yield 0, len(blip)
raise StopIteration
if isinstance(what, basestring):
idx = blip._content.find(what)
count = 0
while idx != -1:
yield idx, idx + len(what)
count += 1
if count == maxres:
raise StopIteration
idx = blip._content.find(what, idx + len(what))
else:
count = 0
for idx, el in blip._elements.items():
if self._elem_matches(el, what, **restrictions):
yield idx, idx + 1
count += 1
if count == maxres:
raise StopIteration
def _execute(self, modify_how, what, bundled_annotations=None):
"""Executes this BlipRefs object.
Args:
modify_how: What to do. Any of the operation declared at the top.
what: Depending on the operation. For delete, has to be None.
For the others it is a singleton, a list or a function returning
what to do; for ANNOTATE tuples of (key, value), for the others
either string or elements.
If what is a function, it takes three parameters, the content of
the blip, the beginning of the matching range and the end.
bundled_annotations: Annotations to apply immediately.
Raises:
IndexError when trying to access content outside of the blip.
ValueError when called with the wrong values.
Returns:
self for chainability.
"""
blip = self._blip
if modify_how != BlipRefs.DELETE:
if type(what) != list:
what = [what]
next_index = 0
matched = []
# updated_elements is used to store the element type of the
# element to update
updated_elements = []
# For now, if we find one markup, we'll use it everywhere.
next = None
hit_found = False
for start, end in self._hits():
hit_found = True
if start < 0:
start += len(blip)
if end == 0:
end += len(blip)
if end < 0:
end += len(blip)
if len(blip) == 0:
if start != 0 or end != 0:
raise IndexError('Start and end have to be 0 for empty document')
elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):
raise IndexError('Position outside the document')
if modify_how == BlipRefs.DELETE:
for i in range(start, end):
if i in blip._elements:
del blip._elements[i]
blip._delete_annotations(start, end)
blip._shift(end, start - end)
blip._content = blip._content[:start] + blip._content[end:]
else:
if callable(what):
next = what(blip._content, start, end)
matched.append(next)
else:
next = what[next_index]
next_index = (next_index + 1) % len(what)
if isinstance(next, str):
next = util.force_unicode(next)
if modify_how == BlipRefs.ANNOTATE:
key, value = next
blip.annotations._add_internal(key, value, start, end)
elif modify_how == BlipRefs.CLEAR_ANNOTATION:
blip.annotations._delete_internal(next, start, end)
elif modify_how == BlipRefs.UPDATE_ELEMENT:
el = blip._elements.get(start)
if not element:
raise ValueError('No element found at index %s' % start)
# the passing around of types this way feels a bit dirty:
updated_elements.append(element.Element.from_json({'type': el.type,
'properties': next}))
for k, b in next.items():
setattr(el, k, b)
else:
if modify_how == BlipRefs.INSERT:
end = start
elif modify_how == BlipRefs.INSERT_AFTER:
start = end
elif modify_how == BlipRefs.REPLACE:
pass
else:
raise ValueError('Unexpected modify_how: ' + modify_how)
if isinstance(next, element.Element):
text = ' '
else:
text = next
# in the case of a replace, and the replacement text is shorter,
# delete the delta.
if start != end and len(text) < end - start:
blip._delete_annotations(start + len(text), end)
blip._shift(end, len(text) + start - end)
blip._content = blip._content[:start] + text + blip._content[end:]
if bundled_annotations:
end_annotation = start + len(text)
blip._delete_annotations(start, end_annotation)
for key, value in bundled_annotations:
blip.annotations._add_internal(key, value, start, end_annotation)
if isinstance(next, element.Element):
blip._elements[start] = next
# No match found, return immediately without generating op.
if not hit_found:
return
operation = blip._operation_queue.document_modify(blip.wave_id,
blip.wavelet_id,
blip.blip_id)
for param, value in self._params.items():
operation.set_param(param, value)
modify_action = {'modifyHow': modify_how}
if modify_how == BlipRefs.DELETE:
pass
elif modify_how == BlipRefs.UPDATE_ELEMENT:
modify_action['elements'] = updated_elements
elif (modify_how == BlipRefs.REPLACE or
modify_how == BlipRefs.INSERT or
modify_how == BlipRefs.INSERT_AFTER):
if callable(what):
what = matched
if what:
if not isinstance(next, element.Element):
modify_action['values'] = [util.force_unicode(value) for value in what]
else:
modify_action['elements'] = what
elif modify_how == BlipRefs.ANNOTATE:
modify_action['values'] = [x[1] for x in what]
modify_action['annotationKey'] = what[0][0]
elif modify_how == BlipRefs.CLEAR_ANNOTATION:
modify_action['annotationKey'] = what[0]
if bundled_annotations:
modify_action['bundledAnnotations'] = [
{'key': key, 'value': value} for key, value in bundled_annotations]
operation.set_param('modifyAction', modify_action)
return self
def insert(self, what, bundled_annotations=None):
"""Inserts what at the matched positions."""
return self._execute(
BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)
def insert_after(self, what, bundled_annotations=None):
"""Inserts what just after the matched positions."""
return self._execute(
BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)
def replace(self, what, bundled_annotations=None):
"""Replaces the matched positions with what."""
return self._execute(
BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)
def delete(self):
"""Deletes the content at the matched positions."""
return self._execute(BlipRefs.DELETE, None)
def annotate(self, name, value=None):
"""Annotates the content at the matched positions.
You can either specify both name and value to set the
same annotation, or supply as the first parameter something
that yields name/value pairs. The name and value should both be strings.
"""
if value is None:
what = name
else:
what = (name, value)
return self._execute(BlipRefs.ANNOTATE, what)
def clear_annotation(self, name):
"""Clears the annotation at the matched positions."""
return self._execute(BlipRefs.CLEAR_ANNOTATION, name)
def update_element(self, new_values):
"""Update an existing element with a set of new values."""
return self._execute(BlipRefs.UPDATE_ELEMENT, new_values)
def __nonzero__(self):
"""Return whether we have a value."""
for start, end in self._hits():
return True
return False
def value(self):
"""Convenience method to convert a BlipRefs to value of its first match."""
for start, end in self._hits():
if end - start == 1 and start in self._blip._elements:
return self._blip._elements[start]
else:
return self._blip.text[start:end]
raise ValueError('BlipRefs has no values')
def __getattr__(self, attribute):
"""Mirror the getattr of value().
This allows for clever things like
first(IMAGE).url
or
blip.annotate_with(key, value).upper()
"""
return getattr(self.value(), attribute)
def __radd__(self, other):
"""Make it possible to add this to a string."""
return other + self.value()
def __cmp__(self, other):
"""Support comparision with target."""
return cmp(self.value(), other)
def __iter__(self):
for start_end in self._hits():
yield start_end
class Blip(object):
"""Models a single blip instance.
Blips are essentially the documents that make up a conversation. Blips can
live in a hierarchy of blips. A root blip has no parent blip id, but all
blips have the ids of the wave and wavelet that they are associated with.
Blips also contain annotations, content and elements, which are accessed via
the Document object.
"""
def __init__(self, json, other_blips, operation_queue):
"""Inits this blip with JSON data.
Args:
json: JSON data dictionary from Wave server.
other_blips: A dictionary like object that can be used to resolve
ids of blips to blips.
operation_queue: an OperationQueue object to store generated operations
in.
"""
self._blip_id = json.get('blipId')
self._operation_queue = operation_queue
self._child_blip_ids = set(json.get('childBlipIds', []))
self._content = json.get('content', '')
self._contributors = set(json.get('contributors', []))
self._creator = json.get('creator')
self._last_modified_time = json.get('lastModifiedTime', 0)
self._version = json.get('version', 0)
self._parent_blip_id = json.get('parentBlipId')
self._wave_id = json.get('waveId')
self._wavelet_id = json.get('waveletId')
if isinstance(other_blips, Blips):
self._other_blips = other_blips
else:
self._other_blips = Blips(other_blips)
self._annotations = Annotations(operation_queue, self)
for annjson in json.get('annotations', []):
r = annjson['range']
self._annotations._add_internal(annjson['name'],
annjson['value'],
r['start'],
r['end'])
self._elements = {}
json_elements = json.get('elements', {})
for elem in json_elements:
self._elements[int(elem)] = element.Element.from_json(json_elements[elem])
self.raw_data = json
@property
def blip_id(self):
"""The id of this blip."""
return self._blip_id
@property
def wave_id(self):
"""The id of the wave that this blip belongs to."""
return self._wave_id
@property
def wavelet_id(self):
"""The id of the wavelet that this blip belongs to."""
return self._wavelet_id
@property
def child_blip_ids(self):
"""The set of the ids of this blip's children."""
return self._child_blip_ids
@property
def child_blips(self):
"""The set of blips that are children of this blip."""
return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids
if blid_id in self._other_blips])
@property
def contributors(self):
"""The set of participant ids that contributed to this blip."""
return self._contributors
@property
def creator(self):
"""The id of the participant that created this blip."""
return self._creator
@property
def last_modified_time(self):
"""The time in seconds since epoch when this blip was last modified."""
return self._last_modified_time
@property
def version(self):
"""The version of this blip."""
return self._version
@property
def parent_blip_id(self):
"""The parent blip_id or None if this is the root blip."""
return self._parent_blip_id
@property
def parent_blip(self):
"""The parent blip or None if it is the root."""
# if parent_blip_id is None, get will also return None
return self._other_blips.get(self._parent_blip_id)
@property
def inline_blip_offset(self):
"""The offset in the parent if this blip is inline or -1 if not.
If the parent is not in the context, this function will always
return -1 since it can't determine the inline blip status.
"""
parent = self.parent_blip
if not parent:
return -1
for offset, el in parent._elements.items():
if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:
return offset
return -1
def is_root(self):
"""Returns whether this is the root blip of a wavelet."""
return self._parent_blip_id is None
@property
def annotations(self):
"""The annotations for this document."""
return self._annotations
@property
def elements(self):
"""Returns a list of elements for this document.
The elements of a blip are things like forms elements and gadgets
that cannot be expressed as plain text. In the text of the blip, you'll
typically find a space as a place holder for the element.
If you want to retrieve the element at a particular index in the blip, use
blip[index].value().
"""
return self._elements.values()
def __len__(self):
return len(self._content)
def __getitem__(self, item):
"""returns a BlipRefs for the given slice."""
if isinstance(item, slice):
if item.step:
raise errors.Error('Step not supported for blip slices')
return self.range(item.start, item.stop)
else:
return self.at(item)
def __setitem__(self, item, value):
"""short cut for self.range/at().replace(value)."""
self.__getitem__(item).replace(value)
def __delitem__(self, item):
"""short cut for self.range/at().delete()."""
self.__getitem__(item).delete()
def _shift(self, where, inc):
"""Move element and annotations after 'where' up by 'inc'."""
new_elements = {}
for idx, el in self._elements.items():
if idx >= where:
idx += inc
new_elements[idx] = el
self._elements = new_elements
self._annotations._shift(where, inc)
def _delete_annotations(self, start, end):
"""Delete all annotations between 'start' and 'end'."""
for annotation_name in self._annotations.names():
self._annotations._delete_internal(annotation_name, start, end)
def all(self, findwhat=None, maxres=-1, **restrictions):
"""Returns a BlipRefs object representing all results for the search.
If searching for an element, the restrictions can be used to specify
additional element properties to filter on, like the url of a Gadget.
"""
return BlipRefs.all(self, findwhat, maxres, **restrictions)
def first(self, findwhat=None, **restrictions):
"""Returns a BlipRefs object representing the first result for the search.
If searching for an element, the restrictions can be used to specify
additional element properties to filter on, like the url of a Gadget.
"""
return BlipRefs.all(self, findwhat, 1, **restrictions)
def at(self, index):
"""Returns a BlipRefs object representing a 1-character range."""
return BlipRefs.range(self, index, index + 1)
def range(self, start, end):
"""Returns a BlipRefs object representing the range."""
return BlipRefs.range(self, start, end)
def serialize(self):
"""Return a dictionary representation of this blip ready for json."""
return {'blipId': self._blip_id,
'childBlipIds': list(self._child_blip_ids),
'content': self._content,
'creator': self._creator,
'contributors': list(self._contributors),
'lastModifiedTime': self._last_modified_time,
'version': self._version,
'parentBlipId': self._parent_blip_id,
'waveId': self._wave_id,
'waveletId': self._wavelet_id,
'annotations': self._annotations.serialize(),
'elements': dict([(index, e.serialize())
for index, e in self._elements.items()])
}
def proxy_for(self, proxy_for_id):
"""Return a view on this blip that will proxy for the specified id.
A shallow copy of the current blip is returned with the proxy_for_id
set. Any modifications made to this copy will be done using the
proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will
be used.
"""
operation_queue = self._operation_queue.proxy_for(proxy_for_id)
res = Blip(json={},
other_blips={},
operation_queue=operation_queue)
res._blip_id = self._blip_id
res._child_blip_ids = self._child_blip_ids
res._content = self._content
res._contributors = self._contributors
res._creator = self._creator
res._last_modified_time = self._last_modified_time
res._version = self._version
res._parent_blip_id = self._parent_blip_id
res._wave_id = self._wave_id
res._wavelet_id = self._wavelet_id
res._other_blips = self._other_blips
res._annotations = self._annotations
res._elements = self._elements
res.raw_data = self.raw_data
return res
@property
def text(self):
"""Returns the raw text content of this document."""
return self._content
def find(self, what, **restrictions):
"""Iterate to matching bits of contents.
Yield either elements or pieces of text.
"""
br = BlipRefs.all(self, what, **restrictions)
for start, end in br._hits():
if end - start == 1 and start in self._elements:
yield self._elements[start]
else:
yield self._content[start:end]
raise StopIteration
def append(self, what, bundled_annotations=None):
"""Convenience method covering a common pattern."""
return BlipRefs.all(self, findwhat=None).insert_after(
what, bundled_annotations=bundled_annotations)
def reply(self):
"""Create and return a reply to this blip."""
blip_data = self._operation_queue.blip_create_child(self.wave_id,
self.wavelet_id,
self.blip_id)
new_blip = Blip(blip_data, self._other_blips, self._operation_queue)
self._other_blips._add(new_blip)
return new_blip
def append_markup(self, markup):
"""Interpret the markup text as xhtml and append the result to the doc.
Args:
markup: The markup'ed text to append.
"""
markup = util.force_unicode(markup)
self._operation_queue.document_append_markup(self.wave_id,
self.wavelet_id,
self.blip_id,
markup)
self._content += util.parse_markup(markup)
def insert_inline_blip(self, position):
"""Inserts an inline blip into this blip at a specific position.
Args:
position: Position to insert the blip at. This has to be greater than 0.
Returns:
The JSON data of the blip that was created.
"""
if position <= 0:
raise IndexError(('Illegal inline blip position: %d. Position has to ' +
'be greater than 0.') % position)
blip_data = self._operation_queue.document_inline_blip_insert(
self.wave_id,
self.wavelet_id,
self.blip_id,
position)
new_blip = Blip(blip_data, self._other_blips, self._operation_queue)
self._other_blips._add(new_blip)
return new_blip
| ajibawa-2023/Python-Code-Large/train/row_1132 | 499 | 889 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Import_L17_C0", "label": "element import element", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0191, 0.0011, 0, 0.66, 0.0, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Import_L18_C0", "label": "errors import errors", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0202, 0.0011, 0, 0.66, 0.1429, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Import_L20_C0", "label": "util import util", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0225, 0.0011, 0, 0.66, 0.2857, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "label": "Annotation", "type": "class", "loc": [22, 87], "level": 0, "parent": null, "vector": [3, 0, 0.0613, 0.0742, 0, 0.66, 0.4286, 568, 0, 7, 0, 0, 186, 0, 0], "semantic": {"name": "Annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Annotation(object):\n \"\"\"Models an annotation on a document.\n\n Annotations are key/value pairs over a range of content. Annotations\n can be used to store data or to be interpreted by a client when displaying\n the data.\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [8, 1, 0.0287, 0.0067, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models an annotation on a document.\n\n Annotations are key/value pairs over a range of content. Annotations\n can be used to store data or to be interpreted by a client when displaying\n the data.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L33_C2", "label": "BACKGROUND_COLOR =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0371, 0.0011, 1, 0.46, 0.0667, 856, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BACKGROUND_COLOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " BACKGROUND_COLOR = \"style/backgroundColor\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L35_C2", "label": "COLOR =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0394, 0.0011, 1, 0.46, 0.1333, 369, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "COLOR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " COLOR = \"style/color\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L37_C2", "label": "FONT_FAMILY =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0416, 0.0011, 1, 0.46, 0.2, 868, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_FAMILY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_FAMILY = \"style/fontFamily\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L39_C2", "label": "FONT_SIZE =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0439, 0.0011, 1, 0.46, 0.2667, 254, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_SIZE = \"style/fontSize\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L41_C2", "label": "FONT_STYLE =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0461, 0.0011, 1, 0.46, 0.3333, 887, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_STYLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_STYLE = \"style/fontStyle\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L43_C2", "label": "FONT_WEIGHT =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0484, 0.0011, 1, 0.46, 0.4, 333, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FONT_WEIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FONT_WEIGHT = \"style/fontWeight\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L45_C2", "label": "TEXT_DECORATION =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0506, 0.0011, 1, 0.46, 0.4667, 618, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TEXT_DECORATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TEXT_DECORATION = \"style/textDecoration\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L47_C2", "label": "VERTICAL_ALIGN =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [14, 1, 0.0529, 0.0011, 1, 0.46, 0.5333, 472, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERTICAL_ALIGN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " VERTICAL_ALIGN = \"style/verticalAlign\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "label": "__init__", "type": "function", "loc": [49, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0574, 0.0056, 1, 0.46, 0.6, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value, start, end):\n self._name = name\n self._value = value\n self._start = start\n self._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L50_C4", "label": "self._name =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "vector": [14, 2, 0.0562, 0.0011, 2, 0.63, 0.0, 257, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._name = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L51_C4", "label": "self._value =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "vector": [14, 2, 0.0574, 0.0011, 2, 0.63, 0.3333, 756, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._value = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L52_C4", "label": "self._start =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "vector": [14, 2, 0.0585, 0.0011, 2, 0.63, 0.6667, 403, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._start = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L53_C4", "label": "self._end =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "vector": [14, 2, 0.0596, 0.0011, 2, 0.63, 1.0, 882, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L56_C2", "label": "name", "type": "function", "loc": [56, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0636, 0.0022, 1, 0.46, 0.6667, 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 return self._name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L57_C4", "label": "return", "type": "return", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L56_C2", "vector": [13, 2, 0.0641, 0.0011, 2, 0.93, 0.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_1132:FunctionDef_L60_C2", "label": "value", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0681, 0.0022, 1, 0.46, 0.7333, 441, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def value(self):\n return self._value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L60_C2", "vector": [13, 2, 0.0686, 0.0011, 2, 0.07, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L64_C2", "label": "start", "type": "function", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0726, 0.0022, 1, 0.46, 0.8, 511, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def start(self):\n return self._start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L64_C2", "vector": [13, 2, 0.0731, 0.0011, 2, 0.65, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L68_C2", "label": "end", "type": "function", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0771, 0.0022, 1, 0.46, 0.8667, 128, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def end(self):\n return self._end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L69_C4", "label": "return", "type": "return", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L68_C2", "vector": [13, 2, 0.0776, 0.0011, 2, 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._end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "label": "_shift", "type": "function", "loc": [71, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0827, 0.0067, 1, 0.46, 0.9333, 613, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\"\n if self._start >= where:\n self._start += inc\n if self._end >= where:\n self._end += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L72_C4", "label": "expression", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "vector": [8, 2, 0.081, 0.0011, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L73_C4", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "vector": [4, 2, 0.0827, 0.0022, 2, 0.72, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._start >= where:\n self._start += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L75_C4", "label": "if", "type": "if", "loc": [75, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "vector": [4, 2, 0.0849, 0.0022, 2, 0.72, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._end >= where:\n self._end += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2", "label": "serialize", "type": "function", "loc": [78, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "vector": [2, 1, 0.0928, 0.0112, 1, 0.46, 1.0, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the annotation.\n\n Returns:\n A dict containing the name, value, and range values.\n \"\"\"\n return {'name': self._name,\n 'value': self._value,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2", "vector": [8, 2, 0.0911, 0.0056, 2, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the annotation.\n\n Returns:\n A dict containing the name, value, and range values.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2", "vector": [13, 2, 0.0962, 0.0045, 2, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'name': self._name,\n 'value': self._value,\n 'range': {'start': self._start,\n 'end': self._end}}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "label": "Annotations", "type": "class", "loc": [90, 201], "level": 0, "parent": null, "vector": [3, 0, 0.1637, 0.126, 0, 0.66, 0.5714, 781, 0, 10, 0, 0, 186, 0, 29], "semantic": {"name": "Annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Annotations(object):\n \"\"\"A dictionary-like object containing the annotations, keyed by name.\"\"\"\n\n def __init__(self, operation_queue, blip):\n self._operation_queue = operation_queue\n self._blip = blip\n self._store = {}\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L91_C2", "label": "expression", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [8, 1, 0.1024, 0.0011, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A dictionary-like object containing the annotations, keyed by name.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "label": "__init__", "type": "function", "loc": [93, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.1063, 0.0045, 1, 0.47, 0.1, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "operation_queue", "blip"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, operation_queue, blip):\n self._operation_queue = operation_queue\n self._blip = blip\n self._store = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L94_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "vector": [14, 2, 0.1057, 0.0011, 2, 0.6, 0.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L95_C4", "label": "self._blip =", "type": "assigned_variable", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "vector": [14, 2, 0.1069, 0.0011, 2, 0.6, 0.5, 818, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blip = blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L96_C4", "label": "self._store =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "vector": [14, 2, 0.108, 0.0011, 2, 0.6, 1.0, 191, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2", "label": "__contains__", "type": "function", "loc": [98, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.1119, 0.0045, 1, 0.47, 0.2, 456, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__contains__", "arg_names": ["self", "what"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, what):\n if isinstance(what, Annotation):\n what = what.name\n return what in self._store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L99_C4", "label": "if", "type": "if", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2", "vector": [4, 2, 0.1119, 0.0022, 2, 0.09, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(what, Annotation):\n what = what.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L100_C6", "label": "what =", "type": "assigned_variable", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L99_C4", "vector": [14, 3, 0.1125, 0.0011, 3, 0.69, 0.0, 63, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = what.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2", "vector": [13, 2, 0.1136, 0.0011, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return what in self._store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2", "label": "_add_internal", "type": "function", "loc": [103, 127], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.1294, 0.0281, 1, 0.47, 0.3, 508, 0, 5, 0, 0, 0, 0, 10], "semantic": {"name": "_add_internal", "arg_names": ["self", "name", "value", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _add_internal(self, name, value, start, end):\n \"\"\"Internal add annotation does not send out operations.\"\"\"\n if name in self._store:\n # TODO: use bisect to make this more efficient.\n new_list = []\n for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2", "vector": [8, 2, 0.117, 0.0011, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Internal add annotation does not send out operations.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "label": "if", "type": "if", "loc": [105, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2", "vector": [4, 2, 0.1305, 0.0259, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name in self._store:\n # TODO: use bisect to make this more efficient.\n new_list = []\n for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L107_C6", "label": "new_list =", "type": "assigned_variable", "loc": [107, 107], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "vector": [14, 3, 0.1204, 0.0011, 3, 0.15, 0.0, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L108_C6", "label": "for existing", "type": "for", "loc": [108, 123], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "vector": [6, 3, 0.1299, 0.018, 3, 0.15, 0.25, 586, 6, 0, 0, 0, 0, 0, 7], "semantic": {"name": "existing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for existing in self._store[name]:\n if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8", "label": "if", "type": "if", "loc": [109, 123], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L108_C6", "vector": [4, 4, 0.1305, 0.0169, 4, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start > existing.end or end < existing.start:\n new_list.append(existing)\n else:\n if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L110_C10", "label": "append()", "type": "expression", "loc": [110, 110], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8", "vector": [8, 5, 0.1237, 0.0011, 5, 0.64, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(existing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "label": "if", "type": "if", "loc": [112, 123], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8", "vector": [4, 5, 0.1322, 0.0135, 5, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.value == value:\n # merge the annotations:\n start = min(existing.start, start)\n end = max(existing.end, end)\n else:\n # chop the bits off the existing annotation\n if existing.start < start:\n new_list.append(Annotation("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L114_C12", "label": "start = min()", "type": "assigned_variable", "loc": [114, 114], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "vector": [14, 6, 0.1282, 0.0011, 6, 0.27, 0.0, 511, 3, 2, 0, 0, 867, 10, 1], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "min", "annotation": ""}, "snippet": " start = min(existing.start, start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L115_C12", "label": "end = max()", "type": "assigned_variable", "loc": [115, 115], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "vector": [14, 6, 0.1294, 0.0011, 6, 0.27, 0.3333, 128, 3, 2, 0, 0, 442, 10, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "max", "annotation": ""}, "snippet": " end = max(existing.end, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L118_C12", "label": "if", "type": "if", "loc": [118, 120], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "vector": [4, 6, 0.1339, 0.0034, 6, 0.27, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.start < start:\n new_list.append(Annotation(\n existing.name, existing.value, existing.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L119_C14", "label": "append()", "type": "expression", "loc": [119, 120], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L118_C12", "vector": [8, 7, 0.1344, 0.0022, 7, 0.82, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(\n existing.name, existing.value, existing.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L121_C12", "label": "if", "type": "if", "loc": [121, 123], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "vector": [4, 6, 0.1372, 0.0034, 6, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if existing.end > end:\n new_list.append(Annotation(\n existing.name, existing.value, existing.end, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L122_C14", "label": "append()", "type": "expression", "loc": [122, 123], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L121_C12", "vector": [8, 7, 0.1378, 0.0022, 7, 0.53, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(\n existing.name, existing.value, existing.end, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L124_C6", "label": "append()", "type": "expression", "loc": [124, 124], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "vector": [8, 3, 0.1395, 0.0011, 3, 0.15, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, value, start, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L125_C6", "label": "assign", "type": "assigned_variable", "loc": [125, 125], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "vector": [14, 3, 0.1406, 0.0011, 3, 0.15, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L127_C6", "label": "assign", "type": "assigned_variable", "loc": [127, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "vector": [14, 3, 0.1429, 0.0011, 3, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = [Annotation(name, value, start, end)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "label": "_delete_internal", "type": "function", "loc": [129, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.1569, 0.0247, 1, 0.47, 0.4, 221, 0, 4, 0, 0, 0, 0, 6], "semantic": {"name": "_delete_internal", "arg_names": ["self", "name", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_internal(self, name, start=0, end=-1):\n \"\"\"Remove the passed annotaion from the internal representation.\"\"\"\n if not name in self._store:\n return\n if end < 0:\n end = len(self._blip) + end\n\n new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L130_C4", "label": "expression", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [8, 2, 0.1462, 0.0011, 2, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Remove the passed annotaion from the internal representation.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L131_C4", "label": "if", "type": "if", "loc": [131, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [4, 2, 0.1479, 0.0022, 2, 0.92, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not name in self._store:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L132_C6", "label": "return", "type": "return", "loc": [132, 132], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L131_C4", "vector": [13, 3, 0.1485, 0.0011, 3, 0.57, 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_1132:If_L133_C4", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [4, 2, 0.1502, 0.0022, 2, 0.92, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end < 0:\n end = len(self._blip) + end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L134_C6", "label": "end =", "type": "assigned_variable", "loc": [134, 134], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L133_C4", "vector": [14, 3, 0.1507, 0.0011, 3, 0.89, 0.0, 128, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = len(self._blip) + end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L136_C4", "label": "new_list =", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [14, 2, 0.153, 0.0011, 2, 0.92, 0.6, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L137_C4", "label": "for a", "type": "for", "loc": [137, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [6, 2, 0.1592, 0.0112, 2, 0.92, 0.8, 475, 6, 0, 0, 0, 0, 0, 5], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for a in self._store[name]:\n if start > a.end or end < a.start:\n new_list.append(a)\n elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6", "label": "if", "type": "if", "loc": [138, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L137_C4", "vector": [4, 3, 0.1597, 0.0101, 3, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start > a.end or end < a.start:\n new_list.append(a)\n elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))\n if a.end > end:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L139_C8", "label": "append()", "type": "expression", "loc": [139, 139], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6", "vector": [8, 4, 0.1564, 0.0011, 4, 0.17, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(a)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6", "label": "if", "type": "if", "loc": [140, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6", "vector": [4, 4, 0.1609, 0.0079, 4, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif start < a.start and end > a.end:\n continue\n else:\n if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))\n if a.end > end:\n new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L143_C8", "label": "if", "type": "if", "loc": [143, 144], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6", "vector": [4, 5, 0.1614, 0.0022, 5, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.start < start:\n new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L144_C10", "label": "append()", "type": "expression", "loc": [144, 144], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L143_C8", "vector": [8, 6, 0.162, 0.0011, 6, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, a.value, a.start, start))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L145_C8", "label": "if", "type": "if", "loc": [145, 146], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6", "vector": [4, 5, 0.1637, 0.0022, 5, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if a.end > end:\n new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L146_C10", "label": "append()", "type": "expression", "loc": [146, 146], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L145_C8", "vector": [8, 6, 0.1642, 0.0011, 6, 0.66, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, a.value, end, a.end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L147_C4", "label": "if", "type": "if", "loc": [147, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "vector": [4, 2, 0.167, 0.0045, 2, 0.92, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_list:\n self._store[name] = new_list\n else:\n del self._store[name]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L148_C6", "label": "assign", "type": "assigned_variable", "loc": [148, 148], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L147_C4", "vector": [14, 3, 0.1665, 0.0011, 3, 0.27, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "label": "_shift", "type": "function", "loc": [152, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.1862, 0.0315, 1, 0.47, 0.5, 613, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\"\n for annotations in self._store.values():\n for annotation in annotations:\n annotation._shift(where, inc)\n\n # Merge fragmented annotations that should be contiguous, for example:\n # Annotation('foo', 'bar', 1, 2) and Annotation('foo', 'bar', 2, 3)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L153_C4", "label": "expression", "type": "expression", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "vector": [8, 2, 0.1721, 0.0011, 2, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Shift annotation by 'inc' if it (partly) overlaps with 'where'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L154_C4", "label": "for annotations", "type": "for", "loc": [154, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "vector": [6, 2, 0.1744, 0.0034, 2, 0.93, 0.5, 398, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotations in self._store.values():\n for annotation in annotations:\n annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L155_C6", "label": "for annotation", "type": "for", "loc": [155, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L154_C4", "vector": [6, 3, 0.1749, 0.0022, 3, 0.49, 0.0, 792, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotation in annotations:\n annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L156_C8", "label": "_shift()", "type": "expression", "loc": [156, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L155_C6", "vector": [8, 4, 0.1755, 0.0011, 4, 0.4, 0.0, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " annotation._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "label": "for name, annotations", "type": "for", "loc": [160, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "vector": [6, 2, 0.1907, 0.0225, 2, 0.93, 1.0, 964, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "name, annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name, annotations in self._store.items():\n new_list = []\n for i, annotation in enumerate(annotations):\n name = annotation.name\n value = annotation.value\n start = annotation.start\n end = annotation.end\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L161_C6", "label": "new_list =", "type": "assigned_variable", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "vector": [14, 3, 0.1811, 0.0011, 3, 0.28, 0.0, 294, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "label": "for i, annotation", "type": "for", "loc": [162, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "vector": [6, 3, 0.1912, 0.0191, 3, 0.28, 0.5, 576, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i, annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i, annotation in enumerate(annotations):\n name = annotation.name\n value = annotation.value\n start = annotation.start\n end = annotation.end\n\n # Find the last end index.\n for j, next_annotation in enumerate(annotations[i + 1:]):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L163_C8", "label": "name =", "type": "assigned_variable", "loc": [163, 163], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [14, 4, 0.1834, 0.0011, 4, 0.74, 0.0, 57, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " name = annotation.name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L164_C8", "label": "value =", "type": "assigned_variable", "loc": [164, 164], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [14, 4, 0.1845, 0.0011, 4, 0.74, 0.2, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = annotation.value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L165_C8", "label": "start =", "type": "assigned_variable", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [14, 4, 0.1856, 0.0011, 4, 0.74, 0.4, 511, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = annotation.start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L166_C8", "label": "end =", "type": "assigned_variable", "loc": [166, 166], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [14, 4, 0.1867, 0.0011, 4, 0.74, 0.6, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8", "label": "for j, next_annotation", "type": "for", "loc": [169, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [6, 4, 0.1946, 0.0101, 4, 0.74, 0.8, 611, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "j, next_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j, next_annotation in enumerate(annotations[i + 1:]):\n # Not contiguous, skip.\n if (end < next_annotation.start):\n break\n\n # Contiguous, merge.\n if (end == next_annotation.start and value == next_annotation.value):\n end = next_annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L171_C10", "label": "if", "type": "if", "loc": [171, 172], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8", "vector": [4, 5, 0.1929, 0.0022, 5, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (end < next_annotation.start):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L175_C10", "label": "if", "type": "if", "loc": [175, 177], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8", "vector": [4, 5, 0.198, 0.0034, 5, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (end == next_annotation.start and value == next_annotation.value):\n end = next_annotation.end\n del annotations[j]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L176_C12", "label": "end =", "type": "assigned_variable", "loc": [176, 176], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L175_C10", "vector": [14, 6, 0.198, 0.0011, 6, 0.69, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = next_annotation.end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L178_C8", "label": "append()", "type": "expression", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "vector": [8, 4, 0.2002, 0.0011, 4, 0.74, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_list.append(Annotation(name, value, start, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L179_C6", "label": "assign", "type": "assigned_variable", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "vector": [14, 3, 0.2013, 0.0011, 3, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._store[name] = new_list"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L181_C2", "label": "__len__", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.2042, 0.0022, 1, 0.47, 0.6, 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 return len(self._store)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L181_C2", "vector": [13, 2, 0.2047, 0.0011, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._store)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L184_C2", "label": "__getitem__", "type": "function", "loc": [184, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.2075, 0.0022, 1, 0.47, 0.7, 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._store[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L185_C4", "label": "return", "type": "return", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L184_C2", "vector": [13, 2, 0.2081, 0.0011, 2, 0.38, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._store[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L187_C2", "label": "__iter__", "type": "function", "loc": [187, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.212, 0.0045, 1, 0.47, 0.8, 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 for l in self._store.values():\n for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L188_C4", "label": "for l", "type": "for", "loc": [188, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L187_C2", "vector": [6, 2, 0.2126, 0.0034, 2, 0.02, 0.0, 810, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in self._store.values():\n for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L189_C6", "label": "for ann", "type": "for", "loc": [189, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L188_C4", "vector": [6, 3, 0.2132, 0.0022, 3, 0.11, 0.0, 763, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "ann", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for ann in l:\n yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L190_C8", "label": "expression", "type": "expression", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L189_C6", "vector": [8, 4, 0.2137, 0.0011, 4, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ann"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2", "label": "names", "type": "function", "loc": [192, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.2171, 0.0034, 1, 0.47, 0.9, 382, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "names", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def names(self):\n \"\"\"Return the names of the annotations in the store.\"\"\"\n return self._store.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L193_C4", "label": "expression", "type": "expression", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2", "vector": [8, 2, 0.2171, 0.0011, 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 names of the annotations in the store.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L194_C4", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2", "vector": [13, 2, 0.2182, 0.0011, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._store.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "label": "serialize", "type": "function", "loc": [196, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "vector": [2, 1, 0.2233, 0.0067, 1, 0.47, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a list of the serialized annotations.\"\"\"\n res = []\n for v in self._store.values():\n res += [a.serialize() for a in v]\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L197_C4", "label": "expression", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "vector": [8, 2, 0.2216, 0.0011, 2, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a list of the serialized annotations.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L198_C4", "label": "res =", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "vector": [14, 2, 0.2227, 0.0011, 2, 0.68, 0.3333, 413, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L199_C4", "label": "for v", "type": "for", "loc": [199, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "vector": [6, 2, 0.2244, 0.0022, 2, 0.68, 0.6667, 553, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for v in self._store.values():\n res += [a.serialize() for a in v]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L201_C4", "label": "return", "type": "return", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "vector": [13, 2, 0.2261, 0.0011, 2, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "label": "Blips", "type": "class", "loc": [204, 248], "level": 0, "parent": null, "vector": [3, 0, 0.2542, 0.0506, 0, 0.66, 0.7143, 32, 0, 8, 0, 0, 186, 0, 6], "semantic": {"name": "Blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Blips(object):\n \"\"\"A dictionary-like object containing the blips, keyed on blip ID.\"\"\"\n\n def __init__(self, blips):\n self._blips = blips\n\n def __getitem__(self, blip_id):\n return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L205_C2", "label": "expression", "type": "expression", "loc": [205, 205], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [8, 1, 0.2306, 0.0011, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A dictionary-like object containing the blips, keyed on blip ID.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L207_C2", "label": "__init__", "type": "function", "loc": [207, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2334, 0.0022, 1, 0.93, 0.125, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "blips"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, blips):\n self._blips = blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L208_C4", "label": "self._blips =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L207_C2", "vector": [14, 2, 0.234, 0.0011, 2, 0.01, 0.0, 720, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blips = blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L210_C2", "label": "__getitem__", "type": "function", "loc": [210, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2368, 0.0022, 1, 0.93, 0.25, 698, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": ["self", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, blip_id):\n return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L211_C4", "label": "return", "type": "return", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L210_C2", "vector": [13, 2, 0.2373, 0.0011, 2, 0.94, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L213_C2", "label": "__iter__", "type": "function", "loc": [213, 214], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2402, 0.0022, 1, 0.93, 0.375, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._blips.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L214_C4", "label": "return", "type": "return", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L213_C2", "vector": [13, 2, 0.2407, 0.0011, 2, 0.44, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L216_C2", "label": "__len__", "type": "function", "loc": [216, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2435, 0.0022, 1, 0.93, 0.5, 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 return len(self._blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L217_C4", "label": "return", "type": "return", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L216_C2", "vector": [13, 2, 0.2441, 0.0011, 2, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L219_C2", "label": "_add", "type": "function", "loc": [219, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2469, 0.0022, 1, 0.93, 0.625, 840, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_add", "arg_names": ["self", "ablip"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _add(self, ablip):\n self._blips[ablip.blip_id] = ablip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L220_C4", "label": "assign", "type": "assigned_variable", "loc": [220, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L219_C2", "vector": [14, 2, 0.2475, 0.0011, 2, 0.51, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blips[ablip.blip_id] = ablip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2", "label": "_remove_with_id", "type": "function", "loc": [222, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2537, 0.009, 1, 0.93, 0.75, 122, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": ["self", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _remove_with_id(self, blip_id):\n del_blip = self._blips[blip_id]\n if del_blip:\n # Remove the reference to this blip from its parent.\n parent_blip = self._blips[blip_id].parent_blip\n if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)\n del self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L223_C4", "label": "del_blip =", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2", "vector": [14, 2, 0.2508, 0.0011, 2, 0.03, 0.0, 492, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "del_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " del_blip = self._blips[blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4", "label": "if", "type": "if", "loc": [224, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2", "vector": [4, 2, 0.2542, 0.0056, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if del_blip:\n # Remove the reference to this blip from its parent.\n parent_blip = self._blips[blip_id].parent_blip\n if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L226_C6", "label": "parent_blip =", "type": "assigned_variable", "loc": [226, 226], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4", "vector": [14, 3, 0.2542, 0.0011, 3, 0.1, 0.0, 445, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent_blip = self._blips[blip_id].parent_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L227_C6", "label": "if", "type": "if", "loc": [227, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4", "vector": [4, 3, 0.2559, 0.0022, 3, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parent_blip:\n parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L228_C8", "label": "remove()", "type": "expression", "loc": [228, 228], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L227_C6", "vector": [8, 4, 0.2565, 0.0011, 4, 0.47, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " parent_blip._child_blip_ids.remove(blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2", "label": "get", "type": "function", "loc": [231, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2638, 0.009, 1, 0.93, 0.875, 607, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self", "blip_id", "default_value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self, blip_id, default_value=None):\n \"\"\"Retrieves a blip.\n\n Returns:\n A Blip object. If none found for the ID, it returns None,\n or if default_value is specified, it returns that.\n \"\"\"\n return self._blips.get(blip_id, default_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L232_C4", "label": "expression", "type": "expression", "loc": [232, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2", "vector": [8, 2, 0.2638, 0.0067, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Retrieves a blip.\n\n Returns:\n A Blip object. If none found for the ID, it returns None,\n or if default_value is specified, it returns that.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L238_C4", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2", "vector": [13, 2, 0.2677, 0.0011, 2, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips.get(blip_id, default_value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "label": "serialize", "type": "function", "loc": [240, 248], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "vector": [2, 1, 0.2745, 0.0101, 1, 0.93, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the blips.\n Returns:\n A dict of serialized blips.\n \"\"\"\n res = {}\n for blip_id, item in self._blips.items():\n res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L241_C4", "label": "expression", "type": "expression", "loc": [241, 244], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "vector": [8, 2, 0.2728, 0.0045, 2, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the blips.\n Returns:\n A dict of serialized blips.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L245_C4", "label": "res =", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "vector": [14, 2, 0.2756, 0.0011, 2, 0.04, 0.3333, 413, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L246_C4", "label": "for blip_id, item", "type": "for", "loc": [246, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "vector": [6, 2, 0.2773, 0.0022, 2, 0.04, 0.6667, 822, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "blip_id, item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for blip_id, item in self._blips.items():\n res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L247_C6", "label": " = serialize()", "type": "assigned_variable", "loc": [247, 247], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L246_C4", "vector": [14, 3, 0.2778, 0.0011, 3, 0.75, 0.0, 0, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " res[blip_id] = item.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L248_C4", "label": "return", "type": "return", "loc": [248, 248], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "vector": [13, 2, 0.279, 0.0011, 2, 0.04, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "label": "BlipRefs", "type": "class", "loc": [251, 578], "level": 0, "parent": null, "vector": [3, 0, 0.4663, 0.369, 0, 0.66, 0.8571, 404, 0, 19, 0, 0, 186, 0, 76], "semantic": {"name": "BlipRefs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipRefs(object):\n \"\"\"Represents a set of references to contents in a blip.\n\n For example, a BlipRefs instance can represent the results\n of a search, an explicitly set range, a regular expression,\n or refer to the entire blip. BlipRefs are used to express\n operations on a blip in a consistent way that can easily\n be transfered to the server."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L252_C2", "label": "expression", "type": "expression", "loc": [252, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [8, 1, 0.2897, 0.0135, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Represents a set of references to contents in a blip.\n\n For example, a BlipRefs instance can represent the results\n of a search, an explicitly set range, a regular expression,\n or refer to the entire blip. BlipRefs are used to express\n operations on a blip in a consistent way that can easily\n be transfered to the server.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L265_C2", "label": "DELETE =", "type": "assigned_variable", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.2981, 0.0011, 1, 0.23, 0.0385, 77, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DELETE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " DELETE = 'DELETE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L266_C2", "label": "REPLACE =", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.2992, 0.0011, 1, 0.23, 0.0769, 96, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "REPLACE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " REPLACE = 'REPLACE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L267_C2", "label": "INSERT =", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.3003, 0.0011, 1, 0.23, 0.1154, 414, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INSERT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INSERT = 'INSERT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L268_C2", "label": "INSERT_AFTER =", "type": "assigned_variable", "loc": [268, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.3015, 0.0011, 1, 0.23, 0.1538, 293, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INSERT_AFTER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INSERT_AFTER = 'INSERT_AFTER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L269_C2", "label": "ANNOTATE =", "type": "assigned_variable", "loc": [269, 269], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.3026, 0.0011, 1, 0.23, 0.1923, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANNOTATE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ANNOTATE = 'ANNOTATE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L270_C2", "label": "CLEAR_ANNOTATION =", "type": "assigned_variable", "loc": [270, 270], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.3037, 0.0011, 1, 0.23, 0.2308, 73, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CLEAR_ANNOTATION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CLEAR_ANNOTATION = 'CLEAR_ANNOTATION'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L271_C2", "label": "UPDATE_ELEMENT =", "type": "assigned_variable", "loc": [271, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [14, 1, 0.3048, 0.0011, 1, 0.23, 0.2692, 592, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "UPDATE_ELEMENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " UPDATE_ELEMENT = 'UPDATE_ELEMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2", "label": "__init__", "type": "function", "loc": [273, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.3082, 0.0034, 1, 0.23, 0.3077, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "blip", "maxres"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, blip, maxres=1):\n self._blip = blip\n self._maxres = maxres"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L274_C4", "label": "self._blip =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2", "vector": [14, 2, 0.3082, 0.0011, 2, 0.45, 0.0, 818, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._blip = blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L275_C4", "label": "self._maxres =", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2", "vector": [14, 2, 0.3093, 0.0011, 2, 0.45, 1.0, 117, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._maxres", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._maxres = maxres"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "label": "all", "type": "function", "loc": [278, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.3223, 0.0202, 1, 0.23, 0.3462, 895, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "all", "arg_names": ["cls", "blip", "findwhat", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def all(cls, blip, findwhat, maxres=-1, **restrictions):\n \"\"\"Construct an instance representing the search for text or elements.\"\"\"\n obj = cls(blip, maxres)\n obj._findwhat = findwhat\n obj._restrictions = restrictions\n obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)\n if findwhat is None:\n # No findWhat, take the entire blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L279_C4", "label": "expression", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [8, 2, 0.3138, 0.0011, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Construct an instance representing the search for text or elements.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L280_C4", "label": "obj = cls()", "type": "assigned_variable", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [14, 2, 0.315, 0.0011, 2, 0.07, 0.1667, 505, 3, 2, 0, 0, 594, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " obj = cls(blip, maxres)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L281_C4", "label": "obj._findwhat =", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [14, 2, 0.3161, 0.0011, 2, 0.07, 0.3333, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._findwhat", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._findwhat = findwhat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L282_C4", "label": "obj._restrictions =", "type": "assigned_variable", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [14, 2, 0.3172, 0.0011, 2, 0.07, 0.5, 533, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._restrictions", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._restrictions = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L283_C4", "label": "obj._hits =", "type": "assigned_variable", "loc": [283, 283], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [14, 2, 0.3183, 0.0011, 2, 0.07, 0.6667, 363, 9, 0, 0, 0, 0, 0, 1], "semantic": {"name": "obj._hits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._hits = lambda: obj._find(findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "label": "if", "type": "if", "loc": [284, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [4, 2, 0.3251, 0.0124, 2, 0.07, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if findwhat is None:\n # No findWhat, take the entire blip\n obj._params = {}\n else:\n query = {'maxRes': maxres}\n if isinstance(findwhat, basestring):\n query['textMatch'] = findwhat\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L286_C6", "label": "obj._params =", "type": "assigned_variable", "loc": [286, 286], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "vector": [14, 3, 0.3217, 0.0011, 3, 0.29, 0.0, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L288_C6", "label": "query =", "type": "assigned_variable", "loc": [288, 288], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "vector": [14, 3, 0.324, 0.0011, 3, 0.29, 0.3333, 546, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query = {'maxRes': maxres}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "label": "if", "type": "if", "loc": [289, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "vector": [4, 3, 0.3273, 0.0056, 3, 0.29, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(findwhat, basestring):\n query['textMatch'] = findwhat\n else:\n query['elementMatch'] = findwhat.class_type\n query['restrictions'] = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L290_C8", "label": "assign", "type": "assigned_variable", "loc": [290, 290], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "vector": [14, 4, 0.3262, 0.0011, 4, 0.77, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['textMatch'] = findwhat"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L292_C8", "label": "assign", "type": "assigned_variable", "loc": [292, 292], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "vector": [14, 4, 0.3285, 0.0011, 4, 0.77, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['elementMatch'] = findwhat.class_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L293_C8", "label": "assign", "type": "assigned_variable", "loc": [293, 293], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "vector": [14, 4, 0.3296, 0.0011, 4, 0.77, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " query['restrictions'] = restrictions"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L294_C6", "label": "obj._params =", "type": "assigned_variable", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "vector": [14, 3, 0.3307, 0.0011, 3, 0.29, 1.0, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {'modifyQuery': query}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L295_C4", "label": "return", "type": "return", "loc": [295, 295], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "vector": [13, 2, 0.3318, 0.0011, 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 obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "label": "range", "type": "function", "loc": [298, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.3391, 0.009, 1, 0.23, 0.3846, 816, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "range", "arg_names": ["cls", "blip", "begin", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def range(cls, blip, begin, end):\n \"\"\"Constructs an instance representing an explicitly set range.\"\"\"\n obj = cls(blip)\n obj._begin = begin\n obj._end = end\n obj._hits = lambda: [(begin, end)]\n obj._params = {'range': {'start': begin, 'end': end}}\n return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L299_C4", "label": "expression", "type": "expression", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [8, 2, 0.3363, 0.0011, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructs an instance representing an explicitly set range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L300_C4", "label": "obj = cls()", "type": "assigned_variable", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [14, 2, 0.3375, 0.0011, 2, 0.0, 0.1667, 505, 3, 1, 0, 0, 594, 10, 1], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " obj = cls(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L301_C4", "label": "obj._begin =", "type": "assigned_variable", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [14, 2, 0.3386, 0.0011, 2, 0.0, 0.3333, 505, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._begin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._begin = begin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L302_C4", "label": "obj._end =", "type": "assigned_variable", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [14, 2, 0.3397, 0.0011, 2, 0.0, 0.5, 470, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._end = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L303_C4", "label": "obj._hits =", "type": "assigned_variable", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [14, 2, 0.3408, 0.0011, 2, 0.0, 0.6667, 363, 9, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj._hits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._hits = lambda: [(begin, end)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L304_C4", "label": "obj._params =", "type": "assigned_variable", "loc": [304, 304], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [14, 2, 0.342, 0.0011, 2, 0.0, 0.8333, 433, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "obj._params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj._params = {'range': {'start': begin, 'end': end}}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "vector": [13, 2, 0.3431, 0.0011, 2, 0.0, 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_1132:FunctionDef_L307_C2", "label": "_elem_matches", "type": "function", "loc": [307, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.3487, 0.0079, 1, 0.23, 0.4231, 781, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "_elem_matches", "arg_names": ["self", "elem", "clz", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _elem_matches(self, elem, clz, **restrictions):\n if not isinstance(elem, clz):\n return False\n for key, val in restrictions.items():\n if getattr(elem, key) != val:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L308_C4", "label": "if", "type": "if", "loc": [308, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "vector": [4, 2, 0.347, 0.0022, 2, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(elem, clz):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L309_C6", "label": "return", "type": "return", "loc": [309, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L308_C4", "vector": [13, 3, 0.3476, 0.0011, 3, 0.14, 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_1132:For_L310_C4", "label": "for key, val", "type": "for", "loc": [310, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "vector": [6, 2, 0.3498, 0.0034, 2, 0.67, 0.5, 372, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "key, val", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, val in restrictions.items():\n if getattr(elem, key) != val:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L311_C6", "label": "if", "type": "if", "loc": [311, 312], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L310_C4", "vector": [4, 3, 0.3504, 0.0022, 3, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if getattr(elem, key) != val:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L312_C8", "label": "return", "type": "return", "loc": [312, 312], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L311_C6", "vector": [13, 4, 0.351, 0.0011, 4, 0.76, 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_1132:Return_L313_C4", "label": "return", "type": "return", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "vector": [13, 2, 0.3521, 0.0011, 2, 0.67, 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_1132:FunctionDef_L315_C2", "label": "_find", "type": "function", "loc": [315, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.3763, 0.045, 1, 0.23, 0.4615, 779, 0, 4, 0, 0, 0, 0, 8], "semantic": {"name": "_find", "arg_names": ["self", "what", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _find(self, what, maxres=-1, **restrictions):\n \"\"\"Iterates where 'what' occurs in the associated blip.\n\n What can be either a string or a class reference.\n Examples:\n self._find('hello') will return the first occurence of the word hello\n self._find(element.Gadget, url='http://example.com/gadget.xml')\n will return the first gadget that has as url example.com."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L316_C4", "label": "expression", "type": "expression", "loc": [316, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "vector": [8, 2, 0.365, 0.0202, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Iterates where 'what' occurs in the associated blip.\n\n What can be either a string or a class reference.\n Examples:\n self._find('hello') will return the first occurence of the word hello\n self._find(element.Gadget, url='http://example.com/gadget.xml')\n will return the first gadget that has as url example.com.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L334_C4", "label": "blip =", "type": "assigned_variable", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "vector": [14, 2, 0.3757, 0.0011, 2, 0.98, 0.3333, 134, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip = self._blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L335_C4", "label": "if", "type": "if", "loc": [335, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "vector": [4, 2, 0.378, 0.0034, 2, 0.98, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what is None:\n yield 0, len(blip)\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L336_C6", "label": "expression", "type": "expression", "loc": [336, 336], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L335_C4", "vector": [8, 3, 0.378, 0.0011, 3, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 0, len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "label": "if", "type": "if", "loc": [338, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "vector": [4, 2, 0.3892, 0.0191, 2, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(what, basestring):\n idx = blip._content.find(what)\n count = 0\n while idx != -1:\n yield idx, idx + len(what)\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L339_C6", "label": "idx = find()", "type": "assigned_variable", "loc": [339, 339], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "vector": [14, 3, 0.3813, 0.0011, 3, 0.88, 0.0, 187, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " idx = blip._content.find(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L340_C6", "label": "count =", "type": "assigned_variable", "loc": [340, 340], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "vector": [14, 3, 0.3825, 0.0011, 3, 0.88, 0.25, 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_1132:While_L341_C6", "label": "while", "type": "while", "loc": [341, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "vector": [5, 3, 0.3864, 0.0067, 3, 0.88, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while idx != -1:\n yield idx, idx + len(what)\n count += 1\n if count == maxres:\n raise StopIteration\n idx = blip._content.find(what, idx + len(what))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L342_C8", "label": "expression", "type": "expression", "loc": [342, 342], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "vector": [8, 4, 0.3847, 0.0011, 4, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield idx, idx + len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L344_C8", "label": "if", "type": "if", "loc": [344, 345], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "vector": [4, 4, 0.3875, 0.0022, 4, 0.54, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L346_C8", "label": "idx = find()", "type": "assigned_variable", "loc": [346, 346], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "vector": [14, 4, 0.3892, 0.0011, 4, 0.54, 1.0, 187, 3, 2, 0, 0, 340, 10, 2], "semantic": {"name": "idx", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " idx = blip._content.find(what, idx + len(what))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L348_C6", "label": "count =", "type": "assigned_variable", "loc": [348, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "vector": [14, 3, 0.3915, 0.0011, 3, 0.88, 0.75, 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_1132:For_L349_C6", "label": "for idx, el", "type": "for", "loc": [349, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "vector": [6, 3, 0.3954, 0.0067, 3, 0.88, 1.0, 946, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "idx, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, el in blip._elements.items():\n if self._elem_matches(el, what, **restrictions):\n yield idx, idx + 1\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8", "label": "if", "type": "if", "loc": [350, 354], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L349_C6", "vector": [4, 4, 0.396, 0.0056, 4, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._elem_matches(el, what, **restrictions):\n yield idx, idx + 1\n count += 1\n if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L351_C10", "label": "expression", "type": "expression", "loc": [351, 351], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8", "vector": [8, 5, 0.3948, 0.0011, 5, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield idx, idx + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L353_C10", "label": "if", "type": "if", "loc": [353, 354], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8", "vector": [4, 5, 0.3976, 0.0022, 5, 0.27, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count == maxres:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "label": "_execute", "type": "function", "loc": [356, 499], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.4809, 0.162, 1, 0.23, 0.5, 205, 0, 4, 1, 0, 0, 0, 45], "semantic": {"name": "_execute", "arg_names": ["self", "modify_how", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _execute(self, modify_how, what, bundled_annotations=None):\n \"\"\"Executes this BlipRefs object.\n\n Args:\n modify_how: What to do. Any of the operation declared at the top.\n what: Depending on the operation. For delete, has to be None.\n For the others it is a singleton, a list or a function returning\n what to do; for ANNOTATE tuples of (key, value), for the others"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L357_C4", "label": "expression", "type": "expression", "loc": [357, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [8, 2, 0.4106, 0.0191, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Executes this BlipRefs object.\n\n Args:\n modify_how: What to do. Any of the operation declared at the top.\n what: Depending on the operation. For delete, has to be None.\n For the others it is a singleton, a list or a function returning\n what to do; for ANNOTATE tuples of (key, value), for the others\n either string or elements."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L374_C4", "label": "blip =", "type": "assigned_variable", "loc": [374, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.4207, 0.0011, 2, 0.67, 0.0667, 134, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip = self._blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4", "label": "if", "type": "if", "loc": [376, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [4, 2, 0.4246, 0.0045, 2, 0.67, 0.1333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how != BlipRefs.DELETE:\n if type(what) != list:\n what = [what]\n next_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L377_C6", "label": "if", "type": "if", "loc": [377, 378], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4", "vector": [4, 3, 0.4246, 0.0022, 3, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if type(what) != list:\n what = [what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L378_C8", "label": "what =", "type": "assigned_variable", "loc": [378, 378], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L377_C6", "vector": [14, 4, 0.4252, 0.0011, 4, 0.45, 0.0, 63, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = [what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L379_C6", "label": "next_index =", "type": "assigned_variable", "loc": [379, 379], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4", "vector": [14, 3, 0.4263, 0.0011, 3, 0.52, 1.0, 91, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "next_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next_index = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L381_C4", "label": "matched =", "type": "assigned_variable", "loc": [381, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.4286, 0.0011, 2, 0.67, 0.2, 962, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "matched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " matched = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L384_C4", "label": "updated_elements =", "type": "assigned_variable", "loc": [384, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.4319, 0.0011, 2, 0.67, 0.2667, 801, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "updated_elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " updated_elements = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L387_C4", "label": "next =", "type": "assigned_variable", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.4353, 0.0011, 2, 0.67, 0.3333, 11, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L388_C4", "label": "hit_found =", "type": "assigned_variable", "loc": [388, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.4364, 0.0011, 2, 0.67, 0.4, 491, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "hit_found", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hit_found = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "label": "for start, end", "type": "for", "loc": [390, 462], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [6, 2, 0.4792, 0.0821, 2, 0.67, 0.4667, 670, 3, 0, 0, 0, 0, 0, 37], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n hit_found = True\n if start < 0:\n start += len(blip)\n if end == 0:\n end += len(blip)\n if end < 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L391_C6", "label": "hit_found =", "type": "assigned_variable", "loc": [391, 391], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "vector": [14, 3, 0.4398, 0.0011, 3, 0.89, 0.0, 491, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "hit_found", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " hit_found = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L392_C6", "label": "if", "type": "if", "loc": [392, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "vector": [4, 3, 0.4426, 0.0045, 3, 0.89, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start < 0:\n start += len(blip)\n if end == 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L394_C8", "label": "if", "type": "if", "loc": [394, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L392_C6", "vector": [4, 4, 0.4438, 0.0022, 4, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end == 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L396_C6", "label": "if", "type": "if", "loc": [396, 397], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "vector": [4, 3, 0.446, 0.0022, 3, 0.89, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end < 0:\n end += len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6", "label": "if", "type": "if", "loc": [398, 402], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "vector": [4, 3, 0.4499, 0.0056, 3, 0.89, 0.75, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(blip) == 0:\n if start != 0 or end != 0:\n raise IndexError('Start and end have to be 0 for empty document')\n elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):\n raise IndexError('Position outside the document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L399_C8", "label": "if", "type": "if", "loc": [399, 400], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6", "vector": [4, 4, 0.4494, 0.0022, 4, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start != 0 or end != 0:\n raise IndexError('Start and end have to be 0 for empty document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L401_C6", "label": "if", "type": "if", "loc": [401, 402], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6", "vector": [4, 4, 0.4516, 0.0022, 4, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif start < 0 or end < 1 or start >= len(blip) or end > len(blip):\n raise IndexError('Position outside the document')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "label": "if", "type": "if", "loc": [403, 462], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "vector": [4, 3, 0.4865, 0.0675, 3, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 28], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.DELETE:\n for i in range(start, end):\n if i in blip._elements:\n del blip._elements[i]\n blip._delete_annotations(start, end)\n blip._shift(end, start - end)\n blip._content = blip._content[:start] + blip._content[end:]\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L404_C8", "label": "for i", "type": "for", "loc": [404, 406], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [6, 4, 0.4556, 0.0034, 4, 0.64, 0.0, 826, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(start, end):\n if i in blip._elements:\n del blip._elements[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L405_C10", "label": "if", "type": "if", "loc": [405, 406], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L404_C8", "vector": [4, 5, 0.4561, 0.0022, 5, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i in blip._elements:\n del blip._elements[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L407_C8", "label": "_delete_annotations()", "type": "expression", "loc": [407, 407], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [8, 4, 0.4578, 0.0011, 4, 0.64, 0.1667, 741, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L408_C8", "label": "_shift()", "type": "expression", "loc": [408, 408], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [8, 4, 0.4589, 0.0011, 4, 0.64, 0.3333, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " blip._shift(end, start - end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L409_C8", "label": "blip._content =", "type": "assigned_variable", "loc": [409, 409], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [14, 4, 0.4601, 0.0011, 4, 0.64, 0.5, 401, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._content = blip._content[:start] + blip._content[end:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "label": "if", "type": "if", "loc": [411, 416], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [4, 4, 0.4651, 0.0067, 4, 0.64, 0.6667, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(what):\n next = what(blip._content, start, end)\n matched.append(next)\n else:\n next = what[next_index]\n next_index = (next_index + 1) % len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L412_C10", "label": "next = what()", "type": "assigned_variable", "loc": [412, 412], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "vector": [14, 5, 0.4634, 0.0011, 5, 0.31, 0.0, 11, 3, 3, 0, 0, 63, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "what", "annotation": ""}, "snippet": " next = what(blip._content, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L413_C10", "label": "append()", "type": "expression", "loc": [413, 413], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "vector": [8, 5, 0.4646, 0.0011, 5, 0.31, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " matched.append(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L415_C10", "label": "next =", "type": "assigned_variable", "loc": [415, 415], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "vector": [14, 5, 0.4668, 0.0011, 5, 0.31, 0.6667, 11, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next = what[next_index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L416_C10", "label": "next_index =", "type": "assigned_variable", "loc": [416, 416], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "vector": [14, 5, 0.4679, 0.0011, 5, 0.31, 1.0, 91, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "next_index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next_index = (next_index + 1) % len(what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L417_C8", "label": "if", "type": "if", "loc": [417, 418], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [4, 4, 0.4696, 0.0022, 4, 0.64, 0.8333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, str):\n next = util.force_unicode(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L418_C10", "label": "next = force_unicode()", "type": "assigned_variable", "loc": [418, 418], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L417_C8", "vector": [14, 5, 0.4702, 0.0011, 5, 0.3, 0.0, 11, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "next", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " next = util.force_unicode(next)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "label": "if", "type": "if", "loc": [419, 462], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "vector": [4, 4, 0.4955, 0.0495, 4, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 19], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.ANNOTATE:\n key, value = next\n blip.annotations._add_internal(key, value, start, end)\n elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n blip.annotations._delete_internal(next, start, end)\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L420_C10", "label": "key, value =", "type": "assigned_variable", "loc": [420, 420], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "vector": [14, 5, 0.4724, 0.0011, 5, 0.19, 0.0, 839, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key, value = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L421_C10", "label": "_add_internal()", "type": "expression", "loc": [421, 421], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "vector": [8, 5, 0.4736, 0.0011, 5, 0.19, 0.5, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " blip.annotations._add_internal(key, value, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8", "label": "if", "type": "if", "loc": [422, 462], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "vector": [4, 5, 0.4972, 0.0461, 5, 0.19, 1.0, 0, 0, 0, 0, 0, 0, 0, 18], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n blip.annotations._delete_internal(next, start, end)\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:\n raise ValueError('No element found at index %s' % start)\n # the passing around of types this way feels a bit dirty:\n updated_elements.append(element.Element.from_json({'type': el.type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L423_C10", "label": "_delete_internal()", "type": "expression", "loc": [423, 423], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8", "vector": [8, 6, 0.4758, 0.0011, 6, 0.37, 0.0, 221, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_internal", "annotation": ""}, "snippet": " blip.annotations._delete_internal(next, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "label": "if", "type": "if", "loc": [424, 462], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8", "vector": [4, 6, 0.4983, 0.0439, 6, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.UPDATE_ELEMENT:\n el = blip._elements.get(start)\n if not element:\n raise ValueError('No element found at index %s' % start)\n # the passing around of types this way feels a bit dirty:\n updated_elements.append(element.Element.from_json({'type': el.type,\n 'properties': next}))\n for k, b in next.items():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L425_C10", "label": "el = get()", "type": "assigned_variable", "loc": [425, 425], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [14, 7, 0.4781, 0.0011, 7, 0.8, 0.0, 144, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " el = blip._elements.get(start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L426_C10", "label": "if", "type": "if", "loc": [426, 427], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.4798, 0.0022, 7, 0.8, 0.1, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element:\n raise ValueError('No element found at index %s' % start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L429_C10", "label": "append()", "type": "expression", "loc": [429, 430], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [8, 7, 0.4831, 0.0022, 7, 0.8, 0.2, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " updated_elements.append(element.Element.from_json({'type': el.type,\n 'properties': next}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L431_C10", "label": "for k, b", "type": "for", "loc": [431, 432], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [6, 7, 0.4854, 0.0022, 7, 0.8, 0.3, 882, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "k, b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, b in next.items():\n setattr(el, k, b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L432_C12", "label": "setattr()", "type": "expression", "loc": [432, 432], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L431_C10", "vector": [8, 8, 0.4859, 0.0011, 8, 0.38, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(el, k, b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10", "label": "if", "type": "if", "loc": [434, 441], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.4921, 0.009, 7, 0.8, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.INSERT:\n end = start\n elif modify_how == BlipRefs.INSERT_AFTER:\n start = end\n elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L435_C12", "label": "end =", "type": "assigned_variable", "loc": [435, 435], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10", "vector": [14, 8, 0.4893, 0.0011, 8, 0.64, 0.0, 128, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10", "label": "if", "type": "if", "loc": [436, 441], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10", "vector": [4, 8, 0.4933, 0.0067, 8, 0.64, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.INSERT_AFTER:\n start = end\n elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L437_C12", "label": "start =", "type": "assigned_variable", "loc": [437, 437], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10", "vector": [14, 9, 0.4916, 0.0011, 9, 0.69, 0.0, 511, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start = end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L438_C10", "label": "if", "type": "if", "loc": [438, 441], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10", "vector": [4, 9, 0.4944, 0.0045, 9, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.REPLACE:\n pass\n else:\n raise ValueError('Unexpected modify_how: ' + modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10", "label": "if", "type": "if", "loc": [443, 446], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.5, 0.0045, 7, 0.8, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, element.Element):\n text = ' '\n else:\n text = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L444_C12", "label": "text =", "type": "assigned_variable", "loc": [444, 444], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10", "vector": [14, 8, 0.4994, 0.0011, 8, 0.1, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = ' '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L446_C12", "label": "text =", "type": "assigned_variable", "loc": [446, 446], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10", "vector": [14, 8, 0.5017, 0.0011, 8, 0.1, 1.0, 439, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L450_C10", "label": "if", "type": "if", "loc": [450, 451], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.5067, 0.0022, 7, 0.8, 0.6, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start != end and len(text) < end - start:\n blip._delete_annotations(start + len(text), end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L451_C12", "label": "_delete_annotations()", "type": "expression", "loc": [451, 451], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L450_C10", "vector": [8, 8, 0.5073, 0.0011, 8, 0.83, 0.0, 741, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start + len(text), end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L453_C10", "label": "_shift()", "type": "expression", "loc": [453, 453], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [8, 7, 0.5096, 0.0011, 7, 0.8, 0.7, 613, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " blip._shift(end, len(text) + start - end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L454_C10", "label": "blip._content =", "type": "assigned_variable", "loc": [454, 454], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [14, 7, 0.5107, 0.0011, 7, 0.8, 0.8, 401, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._content = blip._content[:start] + text + blip._content[end:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "label": "if", "type": "if", "loc": [455, 459], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.5141, 0.0056, 7, 0.8, 0.9, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bundled_annotations:\n end_annotation = start + len(text)\n blip._delete_annotations(start, end_annotation)\n for key, value in bundled_annotations:\n blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L456_C12", "label": "end_annotation =", "type": "assigned_variable", "loc": [456, 456], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "vector": [14, 8, 0.5129, 0.0011, 8, 0.23, 0.0, 943, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "end_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_annotation = start + len(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L457_C12", "label": "_delete_annotations()", "type": "expression", "loc": [457, 457], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "vector": [8, 8, 0.5141, 0.0011, 8, 0.23, 0.5, 741, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_annotations", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_annotations", "annotation": ""}, "snippet": " blip._delete_annotations(start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L458_C12", "label": "for key, value", "type": "for", "loc": [458, 459], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "vector": [6, 8, 0.5157, 0.0022, 8, 0.23, 1.0, 839, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in bundled_annotations:\n blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L459_C14", "label": "_add_internal()", "type": "expression", "loc": [459, 459], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L458_C12", "vector": [8, 9, 0.5163, 0.0011, 9, 0.33, 0.0, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " blip.annotations._add_internal(key, value, start, end_annotation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L461_C10", "label": "if", "type": "if", "loc": [461, 462], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "vector": [4, 7, 0.5191, 0.0022, 7, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(next, element.Element):\n blip._elements[start] = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L462_C12", "label": "assign", "type": "assigned_variable", "loc": [462, 462], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L461_C10", "vector": [14, 8, 0.5197, 0.0011, 8, 0.55, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip._elements[start] = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L465_C4", "label": "if", "type": "if", "loc": [465, 466], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [4, 2, 0.5236, 0.0022, 2, 0.67, 0.5333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not hit_found:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L466_C6", "label": "return", "type": "return", "loc": [466, 466], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L465_C4", "vector": [13, 3, 0.5242, 0.0011, 3, 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_1132:Assign_L468_C4", "label": "operation = document_modify()", "type": "assigned_variable", "loc": [468, 470], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.5276, 0.0034, 2, 0.67, 0.6, 870, 3, 3, 0, 0, 155, 10, 1], "semantic": {"name": "operation", "arg_names": [], "import_names": [], "rhs_call_name": "document_modify", "annotation": ""}, "snippet": " operation = blip._operation_queue.document_modify(blip.wave_id,\n blip.wavelet_id,\n blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L471_C4", "label": "for param, value", "type": "for", "loc": [471, 472], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [6, 2, 0.5304, 0.0022, 2, 0.67, 0.6667, 242, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "param, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param, value in self._params.items():\n operation.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L472_C6", "label": "set_param()", "type": "expression", "loc": [472, 472], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L471_C4", "vector": [8, 3, 0.5309, 0.0011, 3, 0.02, 0.0, 696, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_param", "arg_names": [], "import_names": [], "rhs_call_name": "set_param", "annotation": ""}, "snippet": " operation.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L474_C4", "label": "modify_action =", "type": "assigned_variable", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [14, 2, 0.5332, 0.0011, 2, 0.67, 0.7333, 578, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "modify_action", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action = {'modifyHow': modify_how}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L475_C4", "label": "if", "type": "if", "loc": [475, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [4, 2, 0.5444, 0.0214, 2, 0.67, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if modify_how == BlipRefs.DELETE:\n pass\n elif modify_how == BlipRefs.UPDATE_ELEMENT:\n modify_action['elements'] = updated_elements\n elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4", "label": "if", "type": "if", "loc": [477, 493], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L475_C4", "vector": [4, 3, 0.5456, 0.0191, 3, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.UPDATE_ELEMENT:\n modify_action['elements'] = updated_elements\n elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):\n what = matched\n if what:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L478_C6", "label": "assign", "type": "assigned_variable", "loc": [478, 478], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4", "vector": [14, 4, 0.5377, 0.0011, 4, 0.95, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['elements'] = updated_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "label": "if", "type": "if", "loc": [479, 493], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4", "vector": [4, 4, 0.5467, 0.0169, 4, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif (modify_how == BlipRefs.REPLACE or\n modify_how == BlipRefs.INSERT or\n modify_how == BlipRefs.INSERT_AFTER):\n if callable(what):\n what = matched\n if what:\n if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L482_C6", "label": "if", "type": "if", "loc": [482, 483], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "vector": [4, 5, 0.5427, 0.0022, 5, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(what):\n what = matched"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L483_C8", "label": "what =", "type": "assigned_variable", "loc": [483, 483], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L482_C6", "vector": [14, 6, 0.5433, 0.0011, 6, 0.8, 0.0, 63, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = matched"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L484_C6", "label": "if", "type": "if", "loc": [484, 488], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "vector": [4, 5, 0.5467, 0.0056, 5, 0.89, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if what:\n if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]\n else:\n modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8", "label": "if", "type": "if", "loc": [485, 488], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L484_C6", "vector": [4, 6, 0.5472, 0.0045, 6, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(next, element.Element):\n modify_action['values'] = [util.force_unicode(value) for value in what]\n else:\n modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L486_C10", "label": "assign", "type": "assigned_variable", "loc": [486, 486], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8", "vector": [14, 7, 0.5467, 0.0011, 7, 0.43, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['values'] = [util.force_unicode(value) for value in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L488_C10", "label": "assign", "type": "assigned_variable", "loc": [488, 488], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8", "vector": [14, 7, 0.5489, 0.0011, 7, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['elements'] = what"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "label": "if", "type": "if", "loc": [489, 493], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "vector": [4, 5, 0.5523, 0.0056, 5, 0.89, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.ANNOTATE:\n modify_action['values'] = [x[1] for x in what]\n modify_action['annotationKey'] = what[0][0]\n elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L490_C6", "label": "assign", "type": "assigned_variable", "loc": [490, 490], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "vector": [14, 6, 0.5512, 0.0011, 6, 0.23, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['values'] = [x[1] for x in what]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L491_C6", "label": "assign", "type": "assigned_variable", "loc": [491, 491], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "vector": [14, 6, 0.5523, 0.0011, 6, 0.23, 0.5, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['annotationKey'] = what[0][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L492_C4", "label": "if", "type": "if", "loc": [492, 493], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "vector": [4, 6, 0.554, 0.0022, 6, 0.23, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif modify_how == BlipRefs.CLEAR_ANNOTATION:\n modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L493_C6", "label": "assign", "type": "assigned_variable", "loc": [493, 493], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L492_C4", "vector": [14, 7, 0.5546, 0.0011, 7, 0.18, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['annotationKey'] = what[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L494_C4", "label": "if", "type": "if", "loc": [494, 496], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [4, 2, 0.5568, 0.0034, 2, 0.67, 0.8667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if bundled_annotations:\n modify_action['bundledAnnotations'] = [\n {'key': key, 'value': value} for key, value in bundled_annotations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L495_C6", "label": "assign", "type": "assigned_variable", "loc": [495, 496], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L494_C4", "vector": [14, 3, 0.5574, 0.0022, 3, 0.84, 0.0, 0, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " modify_action['bundledAnnotations'] = [\n {'key': key, 'value': value} for key, value in bundled_annotations]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L497_C4", "label": "set_param()", "type": "expression", "loc": [497, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [8, 2, 0.5591, 0.0011, 2, 0.67, 0.9333, 696, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_param", "arg_names": [], "import_names": [], "rhs_call_name": "set_param", "annotation": ""}, "snippet": " operation.set_param('modifyAction', modify_action)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L499_C4", "label": "return", "type": "return", "loc": [499, 499], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "vector": [13, 2, 0.5613, 0.0011, 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_1132:FunctionDef_L501_C2", "label": "insert", "type": "function", "loc": [501, 504], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.5652, 0.0045, 1, 0.23, 0.5385, 368, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert(self, what, bundled_annotations=None):\n \"\"\"Inserts what at the matched positions.\"\"\"\n return self._execute(\n BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L502_C4", "label": "expression", "type": "expression", "loc": [502, 502], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L501_C2", "vector": [8, 2, 0.5647, 0.0011, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts what at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L503_C4", "label": "return", "type": "return", "loc": [503, 504], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L501_C2", "vector": [13, 2, 0.5664, 0.0022, 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._execute(\n BlipRefs.INSERT, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2", "label": "insert_after", "type": "function", "loc": [506, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.5709, 0.0045, 1, 0.23, 0.5769, 441, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "insert_after", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert_after(self, what, bundled_annotations=None):\n \"\"\"Inserts what just after the matched positions.\"\"\"\n return self._execute(\n BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L507_C4", "label": "expression", "type": "expression", "loc": [507, 507], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2", "vector": [8, 2, 0.5703, 0.0011, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts what just after the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L508_C4", "label": "return", "type": "return", "loc": [508, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2", "vector": [13, 2, 0.572, 0.0022, 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._execute(\n BlipRefs.INSERT_AFTER, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2", "label": "replace", "type": "function", "loc": [511, 514], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.5765, 0.0045, 1, 0.23, 0.6154, 293, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(self, what, bundled_annotations=None):\n \"\"\"Replaces the matched positions with what.\"\"\"\n return self._execute(\n BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L512_C4", "label": "expression", "type": "expression", "loc": [512, 512], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2", "vector": [8, 2, 0.5759, 0.0011, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Replaces the matched positions with what.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L513_C4", "label": "return", "type": "return", "loc": [513, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2", "vector": [13, 2, 0.5776, 0.0022, 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._execute(\n BlipRefs.REPLACE, what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2", "label": "delete", "type": "function", "loc": [516, 518], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.5816, 0.0034, 1, 0.23, 0.6538, 266, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self):\n \"\"\"Deletes the content at the matched positions.\"\"\"\n return self._execute(BlipRefs.DELETE, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L517_C4", "label": "expression", "type": "expression", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2", "vector": [8, 2, 0.5816, 0.0011, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deletes the content at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L518_C4", "label": "return", "type": "return", "loc": [518, 518], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2", "vector": [13, 2, 0.5827, 0.0011, 2, 0.79, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._execute(BlipRefs.DELETE, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "label": "annotate", "type": "function", "loc": [520, 531], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.5911, 0.0135, 1, 0.23, 0.6923, 296, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def annotate(self, name, value=None):\n \"\"\"Annotates the content at the matched positions.\n\n You can either specify both name and value to set the\n same annotation, or supply as the first parameter something\n that yields name/value pairs. The name and value should both be strings.\n \"\"\"\n if value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L521_C4", "label": "expression", "type": "expression", "loc": [521, 526], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "vector": [8, 2, 0.5889, 0.0067, 2, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Annotates the content at the matched positions.\n\n You can either specify both name and value to set the\n same annotation, or supply as the first parameter something\n that yields name/value pairs. The name and value should both be strings.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4", "label": "if", "type": "if", "loc": [527, 530], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "vector": [4, 2, 0.5945, 0.0045, 2, 0.54, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None:\n what = name\n else:\n what = (name, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L528_C6", "label": "what =", "type": "assigned_variable", "loc": [528, 528], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4", "vector": [14, 3, 0.5939, 0.0011, 3, 0.26, 0.0, 63, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = name"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L530_C6", "label": "what =", "type": "assigned_variable", "loc": [530, 530], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4", "vector": [14, 3, 0.5962, 0.0011, 3, 0.26, 1.0, 63, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "what", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " what = (name, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L531_C4", "label": "return", "type": "return", "loc": [531, 531], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "vector": [13, 2, 0.5973, 0.0011, 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._execute(BlipRefs.ANNOTATE, what)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2", "label": "clear_annotation", "type": "function", "loc": [533, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.6007, 0.0034, 1, 0.23, 0.7308, 359, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "clear_annotation", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear_annotation(self, name):\n \"\"\"Clears the annotation at the matched positions.\"\"\"\n return self._execute(BlipRefs.CLEAR_ANNOTATION, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L534_C4", "label": "expression", "type": "expression", "loc": [534, 534], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2", "vector": [8, 2, 0.6007, 0.0011, 2, 0.5, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Clears the annotation at the matched positions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L535_C4", "label": "return", "type": "return", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2", "vector": [13, 2, 0.6018, 0.0011, 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 self._execute(BlipRefs.CLEAR_ANNOTATION, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2", "label": "update_element", "type": "function", "loc": [537, 539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.6052, 0.0034, 1, 0.23, 0.7692, 879, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": ["self", "new_values"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def update_element(self, new_values):\n \"\"\"Update an existing element with a set of new values.\"\"\"\n return self._execute(BlipRefs.UPDATE_ELEMENT, new_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L538_C4", "label": "expression", "type": "expression", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2", "vector": [8, 2, 0.6052, 0.0011, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Update an existing element with a set of new values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L539_C4", "label": "return", "type": "return", "loc": [539, 539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2", "vector": [13, 2, 0.6063, 0.0011, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._execute(BlipRefs.UPDATE_ELEMENT, new_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "label": "__nonzero__", "type": "function", "loc": [541, 545], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.6108, 0.0056, 1, 0.23, 0.8077, 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 whether we have a value.\"\"\"\n for start, end in self._hits():\n return True\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L542_C4", "label": "expression", "type": "expression", "loc": [542, 542], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "vector": [8, 2, 0.6097, 0.0011, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return whether we have a value.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L543_C4", "label": "for start, end", "type": "for", "loc": [543, 544], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "vector": [6, 2, 0.6114, 0.0022, 2, 0.12, 0.5, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L544_C6", "label": "return", "type": "return", "loc": [544, 544], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L543_C4", "vector": [13, 3, 0.6119, 0.0011, 3, 0.71, 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_1132:Return_L545_C4", "label": "return", "type": "return", "loc": [545, 545], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "vector": [13, 2, 0.613, 0.0011, 2, 0.12, 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_1132:FunctionDef_L547_C2", "label": "value", "type": "function", "loc": [547, 554], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.6192, 0.009, 1, 0.23, 0.8462, 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 \"\"\"Convenience method to convert a BlipRefs to value of its first match.\"\"\"\n for start, end in self._hits():\n if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]\n raise ValueError('BlipRefs has no values')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L548_C4", "label": "expression", "type": "expression", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L547_C2", "vector": [8, 2, 0.6164, 0.0011, 2, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convenience method to convert a BlipRefs to value of its first match.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L549_C4", "label": "for start, end", "type": "for", "loc": [549, 553], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L547_C2", "vector": [6, 2, 0.6198, 0.0056, 2, 0.48, 1.0, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in self._hits():\n if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6", "label": "if", "type": "if", "loc": [550, 553], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L549_C4", "vector": [4, 3, 0.6204, 0.0045, 3, 0.76, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end - start == 1 and start in self._blip._elements:\n return self._blip._elements[start]\n else:\n return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L551_C8", "label": "return", "type": "return", "loc": [551, 551], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6", "vector": [13, 4, 0.6198, 0.0011, 4, 0.65, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip._elements[start]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L553_C8", "label": "return", "type": "return", "loc": [553, 553], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6", "vector": [13, 4, 0.622, 0.0011, 4, 0.65, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip.text[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2", "label": "__getattr__", "type": "function", "loc": [556, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.631, 0.0124, 1, 0.23, 0.8846, 210, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__getattr__", "arg_names": ["self", "attribute"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, attribute):\n \"\"\"Mirror the getattr of value().\n\n This allows for clever things like\n first(IMAGE).url\n\n or\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L557_C4", "label": "expression", "type": "expression", "loc": [557, 565], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2", "vector": [8, 2, 0.631, 0.0101, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Mirror the getattr of value().\n\n This allows for clever things like\n first(IMAGE).url\n\n or\n\n blip.annotate_with(key, value).upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L566_C4", "label": "return", "type": "return", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2", "vector": [13, 2, 0.6367, 0.0011, 2, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return getattr(self.value(), attribute)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2", "label": "__radd__", "type": "function", "loc": [568, 570], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.64, 0.0034, 1, 0.23, 0.9231, 241, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "__radd__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __radd__(self, other):\n \"\"\"Make it possible to add this to a string.\"\"\"\n return other + self.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L569_C4", "label": "expression", "type": "expression", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2", "vector": [8, 2, 0.64, 0.0011, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Make it possible to add this to a string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L570_C4", "label": "return", "type": "return", "loc": [570, 570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2", "vector": [13, 2, 0.6412, 0.0011, 2, 0.17, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return other + self.value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2", "label": "__cmp__", "type": "function", "loc": [572, 574], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.6445, 0.0034, 1, 0.23, 0.9615, 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 \"\"\"Support comparision with target.\"\"\"\n return cmp(self.value(), other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L573_C4", "label": "expression", "type": "expression", "loc": [573, 573], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2", "vector": [8, 2, 0.6445, 0.0011, 2, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Support comparision with target.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L574_C4", "label": "return", "type": "return", "loc": [574, 574], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2", "vector": [13, 2, 0.6457, 0.0011, 2, 0.45, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cmp(self.value(), other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L576_C2", "label": "__iter__", "type": "function", "loc": [576, 578], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "vector": [2, 1, 0.649, 0.0034, 1, 0.23, 1.0, 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 for start_end in self._hits():\n yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L577_C4", "label": "for start_end", "type": "for", "loc": [577, 578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L576_C2", "vector": [6, 2, 0.6496, 0.0022, 2, 0.61, 0.0, 220, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start_end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start_end in self._hits():\n yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L578_C6", "label": "expression", "type": "expression", "loc": [578, 578], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L577_C4", "vector": [8, 3, 0.6502, 0.0011, 3, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield start_end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "label": "Blip", "type": "class", "loc": [581, 889], "level": 0, "parent": null, "vector": [3, 0, 0.8268, 0.3476, 0, 0.66, 1.0, 762, 0, 34, 0, 0, 186, 0, 63], "semantic": {"name": "Blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Blip(object):\n \"\"\"Models a single blip instance.\n\n Blips are essentially the documents that make up a conversation. Blips can\n live in a hierarchy of blips. A root blip has no parent blip id, but all\n blips have the ids of the wave and wavelet that they are associated with.\n\n Blips also contain annotations, content and elements, which are accessed via"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L582_C2", "label": "expression", "type": "expression", "loc": [582, 590], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [8, 1, 0.6592, 0.0101, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models a single blip instance.\n\n Blips are essentially the documents that make up a conversation. Blips can\n live in a hierarchy of blips. A root blip has no parent blip id, but all\n blips have the ids of the wave and wavelet that they are associated with.\n\n Blips also contain annotations, content and elements, which are accessed via\n the Document object."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "label": "__init__", "type": "function", "loc": [592, 628], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.6862, 0.0416, 1, 0.36, 0.0294, 555, 0, 4, 0, 0, 0, 0, 20], "semantic": {"name": "__init__", "arg_names": ["self", "json", "other_blips", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, other_blips, operation_queue):\n \"\"\"Inits this blip with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n other_blips: A dictionary like object that can be used to resolve\n ids of blips to blips.\n operation_queue: an OperationQueue object to store generated operations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L593_C4", "label": "expression", "type": "expression", "loc": [593, 601], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [8, 2, 0.6715, 0.0101, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this blip with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n other_blips: A dictionary like object that can be used to resolve\n ids of blips to blips.\n operation_queue: an OperationQueue object to store generated operations\n in."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L602_C4", "label": "self._blip_id = get()", "type": "assigned_variable", "loc": [602, 602], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6772, 0.0011, 2, 0.91, 0.0556, 70, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._blip_id = json.get('blipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L603_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [603, 603], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6783, 0.0011, 2, 0.91, 0.1111, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L604_C4", "label": "self._child_blip_ids = set()", "type": "assigned_variable", "loc": [604, 604], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6794, 0.0011, 2, 0.91, 0.1667, 595, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "self._child_blip_ids", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._child_blip_ids = set(json.get('childBlipIds', []))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L605_C4", "label": "self._content = get()", "type": "assigned_variable", "loc": [605, 605], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6805, 0.0011, 2, 0.91, 0.2222, 620, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._content", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._content = json.get('content', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L606_C4", "label": "self._contributors = set()", "type": "assigned_variable", "loc": [606, 606], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6817, 0.0011, 2, 0.91, 0.2778, 892, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "self._contributors", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._contributors = set(json.get('contributors', []))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L607_C4", "label": "self._creator = get()", "type": "assigned_variable", "loc": [607, 607], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6828, 0.0011, 2, 0.91, 0.3333, 777, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._creator", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creator = json.get('creator')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L608_C4", "label": "self._last_modified_time = get()", "type": "assigned_variable", "loc": [608, 608], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6839, 0.0011, 2, 0.91, 0.3889, 351, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._last_modified_time = json.get('lastModifiedTime', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L609_C4", "label": "self._version = get()", "type": "assigned_variable", "loc": [609, 609], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.685, 0.0011, 2, 0.91, 0.4444, 711, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._version", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._version = json.get('version', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L610_C4", "label": "self._parent_blip_id = get()", "type": "assigned_variable", "loc": [610, 610], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6862, 0.0011, 2, 0.91, 0.5, 159, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._parent_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._parent_blip_id = json.get('parentBlipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L611_C4", "label": "self._wave_id = get()", "type": "assigned_variable", "loc": [611, 611], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6873, 0.0011, 2, 0.91, 0.5556, 26, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wave_id = json.get('waveId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L612_C4", "label": "self._wavelet_id = get()", "type": "assigned_variable", "loc": [612, 612], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.6884, 0.0011, 2, 0.91, 0.6111, 575, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wavelet_id = json.get('waveletId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4", "label": "if", "type": "if", "loc": [613, 616], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [4, 2, 0.6912, 0.0045, 2, 0.91, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other_blips, Blips):\n self._other_blips = other_blips\n else:\n self._other_blips = Blips(other_blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L614_C6", "label": "self._other_blips =", "type": "assigned_variable", "loc": [614, 614], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4", "vector": [14, 3, 0.6907, 0.0011, 3, 0.61, 0.0, 542, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._other_blips = other_blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L616_C6", "label": "self._other_blips = Blips()", "type": "assigned_variable", "loc": [616, 616], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4", "vector": [14, 3, 0.6929, 0.0011, 3, 0.61, 1.0, 542, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "self._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " self._other_blips = Blips(other_blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L617_C4", "label": "self._annotations = Annotations()", "type": "assigned_variable", "loc": [617, 617], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.694, 0.0011, 2, 0.91, 0.7222, 683, 3, 2, 0, 0, 781, 10, 1], "semantic": {"name": "self._annotations", "arg_names": [], "import_names": [], "rhs_call_name": "Annotations", "annotation": ""}, "snippet": " self._annotations = Annotations(operation_queue, self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4", "label": "for annjson", "type": "for", "loc": [618, 623], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [6, 2, 0.698, 0.0067, 2, 0.91, 0.7778, 294, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annjson", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annjson in json.get('annotations', []):\n r = annjson['range']\n self._annotations._add_internal(annjson['name'],\n annjson['value'],\n r['start'],\n r['end'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L619_C6", "label": "r =", "type": "assigned_variable", "loc": [619, 619], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4", "vector": [14, 3, 0.6963, 0.0011, 3, 0.14, 0.0, 436, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "r", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " r = annjson['range']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L620_C6", "label": "_add_internal()", "type": "expression", "loc": [620, 623], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4", "vector": [8, 3, 0.6991, 0.0045, 3, 0.14, 1.0, 508, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "_add_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_add_internal", "annotation": ""}, "snippet": " self._annotations._add_internal(annjson['name'],\n annjson['value'],\n r['start'],\n r['end'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L624_C4", "label": "self._elements =", "type": "assigned_variable", "loc": [624, 624], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.7019, 0.0011, 2, 0.91, 0.8333, 809, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._elements = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L625_C4", "label": "json_elements = get()", "type": "assigned_variable", "loc": [625, 625], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.703, 0.0011, 2, 0.91, 0.8889, 180, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "json_elements", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " json_elements = json.get('elements', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L626_C4", "label": "for elem", "type": "for", "loc": [626, 627], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [6, 2, 0.7047, 0.0022, 2, 0.91, 0.9444, 63, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in json_elements:\n self._elements[int(elem)] = element.Element.from_json(json_elements[elem])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L627_C6", "label": " = from_json()", "type": "assigned_variable", "loc": [627, 627], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L626_C4", "vector": [14, 3, 0.7053, 0.0011, 3, 0.86, 0.0, 0, 3, 1, 0, 0, 975, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " self._elements[int(elem)] = element.Element.from_json(json_elements[elem])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L628_C4", "label": "self.raw_data =", "type": "assigned_variable", "loc": [628, 628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "vector": [14, 2, 0.7064, 0.0011, 2, 0.91, 1.0, 25, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2", "label": "blip_id", "type": "function", "loc": [631, 633], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7109, 0.0034, 1, 0.36, 0.0588, 161, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_id(self):\n \"\"\"The id of this blip.\"\"\"\n return self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L632_C4", "label": "expression", "type": "expression", "loc": [632, 632], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2", "vector": [8, 2, 0.7109, 0.0011, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L633_C4", "label": "return", "type": "return", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2", "vector": [13, 2, 0.712, 0.0011, 2, 0.33, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2", "label": "wave_id", "type": "function", "loc": [636, 638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7165, 0.0034, 1, 0.36, 0.0882, 347, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wave_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wave_id(self):\n \"\"\"The id of the wave that this blip belongs to.\"\"\"\n return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L637_C4", "label": "expression", "type": "expression", "loc": [637, 637], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2", "vector": [8, 2, 0.7165, 0.0011, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of the wave that this blip belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L638_C4", "label": "return", "type": "return", "loc": [638, 638], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2", "vector": [13, 2, 0.7177, 0.0011, 2, 0.79, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2", "label": "wavelet_id", "type": "function", "loc": [641, 643], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7222, 0.0034, 1, 0.36, 0.1176, 269, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_id(self):\n \"\"\"The id of the wavelet that this blip belongs to.\"\"\"\n return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L642_C4", "label": "expression", "type": "expression", "loc": [642, 642], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2", "vector": [8, 2, 0.7222, 0.0011, 2, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of the wavelet that this blip belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L643_C4", "label": "return", "type": "return", "loc": [643, 643], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2", "vector": [13, 2, 0.7233, 0.0011, 2, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2", "label": "child_blip_ids", "type": "function", "loc": [646, 648], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7278, 0.0034, 1, 0.36, 0.1471, 660, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "child_blip_ids", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def child_blip_ids(self):\n \"\"\"The set of the ids of this blip's children.\"\"\"\n return self._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L647_C4", "label": "expression", "type": "expression", "loc": [647, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2", "vector": [8, 2, 0.7278, 0.0011, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of the ids of this blip's children.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L648_C4", "label": "return", "type": "return", "loc": [648, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2", "vector": [13, 2, 0.7289, 0.0011, 2, 0.41, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2", "label": "child_blips", "type": "function", "loc": [651, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.734, 0.0045, 1, 0.36, 0.1765, 177, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "child_blips", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def child_blips(self):\n \"\"\"The set of blips that are children of this blip.\"\"\"\n return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids\n if blid_id in self._other_blips])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L652_C4", "label": "expression", "type": "expression", "loc": [652, 652], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2", "vector": [8, 2, 0.7334, 0.0011, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of blips that are children of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L653_C4", "label": "return", "type": "return", "loc": [653, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2", "vector": [13, 2, 0.7351, 0.0022, 2, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return set([self._other_blips[blid_id] for blid_id in self._child_blip_ids\n if blid_id in self._other_blips])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2", "label": "contributors", "type": "function", "loc": [657, 659], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7402, 0.0034, 1, 0.36, 0.2059, 663, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "contributors", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def contributors(self):\n \"\"\"The set of participant ids that contributed to this blip.\"\"\"\n return self._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L658_C4", "label": "expression", "type": "expression", "loc": [658, 658], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2", "vector": [8, 2, 0.7402, 0.0011, 2, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The set of participant ids that contributed to this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L659_C4", "label": "return", "type": "return", "loc": [659, 659], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2", "vector": [13, 2, 0.7413, 0.0011, 2, 0.86, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2", "label": "creator", "type": "function", "loc": [662, 664], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7458, 0.0034, 1, 0.36, 0.2353, 608, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creator(self):\n \"\"\"The id of the participant that created this blip.\"\"\"\n return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L663_C4", "label": "expression", "type": "expression", "loc": [663, 663], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2", "vector": [8, 2, 0.7458, 0.0011, 2, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The id of the participant that created this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L664_C4", "label": "return", "type": "return", "loc": [664, 664], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2", "vector": [13, 2, 0.7469, 0.0011, 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._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2", "label": "last_modified_time", "type": "function", "loc": [667, 669], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7514, 0.0034, 1, 0.36, 0.2647, 538, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "last_modified_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def last_modified_time(self):\n \"\"\"The time in seconds since epoch when this blip was last modified.\"\"\"\n return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L668_C4", "label": "expression", "type": "expression", "loc": [668, 668], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2", "vector": [8, 2, 0.7514, 0.0011, 2, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The time in seconds since epoch when this blip was last modified.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L669_C4", "label": "return", "type": "return", "loc": [669, 669], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2", "vector": [13, 2, 0.7525, 0.0011, 2, 0.55, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2", "label": "version", "type": "function", "loc": [672, 674], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.757, 0.0034, 1, 0.36, 0.2941, 623, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def version(self):\n \"\"\"The version of this blip.\"\"\"\n return self._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L673_C4", "label": "expression", "type": "expression", "loc": [673, 673], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2", "vector": [8, 2, 0.757, 0.0011, 2, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The version of this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L674_C4", "label": "return", "type": "return", "loc": [674, 674], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2", "vector": [13, 2, 0.7582, 0.0011, 2, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2", "label": "parent_blip_id", "type": "function", "loc": [677, 679], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7627, 0.0034, 1, 0.36, 0.3235, 196, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "parent_blip_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parent_blip_id(self):\n \"\"\"The parent blip_id or None if this is the root blip.\"\"\"\n return self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L678_C4", "label": "expression", "type": "expression", "loc": [678, 678], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2", "vector": [8, 2, 0.7627, 0.0011, 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 parent blip_id or None if this is the root blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L679_C4", "label": "return", "type": "return", "loc": [679, 679], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2", "vector": [13, 2, 0.7638, 0.0011, 2, 0.49, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2", "label": "parent_blip", "type": "function", "loc": [682, 685], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7688, 0.0045, 1, 0.36, 0.3529, 445, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "parent_blip", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def parent_blip(self):\n \"\"\"The parent blip or None if it is the root.\"\"\"\n # if parent_blip_id is None, get will also return None\n return self._other_blips.get(self._parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L683_C4", "label": "expression", "type": "expression", "loc": [683, 683], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2", "vector": [8, 2, 0.7683, 0.0011, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The parent blip or None if it is the root.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L685_C4", "label": "return", "type": "return", "loc": [685, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2", "vector": [13, 2, 0.7705, 0.0011, 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._other_blips.get(self._parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "label": "inline_blip_offset", "type": "function", "loc": [688, 700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7807, 0.0146, 1, 0.36, 0.3824, 397, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "inline_blip_offset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def inline_blip_offset(self):\n \"\"\"The offset in the parent if this blip is inline or -1 if not.\n\n If the parent is not in the context, this function will always\n return -1 since it can't determine the inline blip status.\n \"\"\"\n parent = self.parent_blip\n if not parent:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L689_C4", "label": "expression", "type": "expression", "loc": [689, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "vector": [8, 2, 0.7773, 0.0056, 2, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The offset in the parent if this blip is inline or -1 if not.\n\n If the parent is not in the context, this function will always\n return -1 since it can't determine the inline blip status.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L694_C4", "label": "parent =", "type": "assigned_variable", "loc": [694, 694], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "vector": [14, 2, 0.7807, 0.0011, 2, 0.58, 0.25, 80, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parent = self.parent_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L695_C4", "label": "if", "type": "if", "loc": [695, 696], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "vector": [4, 2, 0.7823, 0.0022, 2, 0.58, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parent:\n return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L696_C6", "label": "return", "type": "return", "loc": [696, 696], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L695_C4", "vector": [13, 3, 0.7829, 0.0011, 3, 0.88, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L697_C4", "label": "for offset, el", "type": "for", "loc": [697, 699], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "vector": [6, 2, 0.7852, 0.0034, 2, 0.58, 0.75, 699, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "offset, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for offset, el in parent._elements.items():\n if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:\n return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L698_C6", "label": "if", "type": "if", "loc": [698, 699], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L697_C4", "vector": [4, 3, 0.7857, 0.0022, 3, 0.72, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if el.type == element.Element.INLINE_BLIP_TYPE and el.id == self.blip_id:\n return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L699_C8", "label": "return", "type": "return", "loc": [699, 699], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L698_C6", "vector": [13, 4, 0.7863, 0.0011, 4, 0.37, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L700_C4", "label": "return", "type": "return", "loc": [700, 700], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "vector": [13, 2, 0.7874, 0.0011, 2, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2", "label": "is_root", "type": "function", "loc": [702, 704], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7908, 0.0034, 1, 0.36, 0.4118, 748, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "is_root", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def is_root(self):\n \"\"\"Returns whether this is the root blip of a wavelet.\"\"\"\n return self._parent_blip_id is None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L703_C4", "label": "expression", "type": "expression", "loc": [703, 703], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2", "vector": [8, 2, 0.7908, 0.0011, 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 whether this is the root blip of a wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L704_C4", "label": "return", "type": "return", "loc": [704, 704], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2", "vector": [13, 2, 0.7919, 0.0011, 2, 0.03, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._parent_blip_id is None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2", "label": "annotations", "type": "function", "loc": [707, 709], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.7964, 0.0034, 1, 0.36, 0.4412, 398, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "annotations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def annotations(self):\n \"\"\"The annotations for this document.\"\"\"\n return self._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L708_C4", "label": "expression", "type": "expression", "loc": [708, 708], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2", "vector": [8, 2, 0.7964, 0.0011, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The annotations for this document.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L709_C4", "label": "return", "type": "return", "loc": [709, 709], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2", "vector": [13, 2, 0.7975, 0.0011, 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._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2", "label": "elements", "type": "function", "loc": [712, 720], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8054, 0.0101, 1, 0.36, 0.4706, 915, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "elements", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def elements(self):\n \"\"\"Returns a list of elements for this document.\n The elements of a blip are things like forms elements and gadgets\n that cannot be expressed as plain text. In the text of the blip, you'll\n typically find a space as a place holder for the element.\n If you want to retrieve the element at a particular index in the blip, use\n blip[index].value().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L713_C4", "label": "expression", "type": "expression", "loc": [713, 719], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2", "vector": [8, 2, 0.8054, 0.0079, 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 a list of elements for this document.\n The elements of a blip are things like forms elements and gadgets\n that cannot be expressed as plain text. In the text of the blip, you'll\n typically find a space as a place holder for the element.\n If you want to retrieve the element at a particular index in the blip, use\n blip[index].value().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L720_C4", "label": "return", "type": "return", "loc": [720, 720], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2", "vector": [13, 2, 0.8099, 0.0011, 2, 0.8, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._elements.values()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L722_C2", "label": "__len__", "type": "function", "loc": [722, 723], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8127, 0.0022, 1, 0.36, 0.5, 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 return len(self._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L723_C4", "label": "return", "type": "return", "loc": [723, 723], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L722_C2", "vector": [13, 2, 0.8133, 0.0011, 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 len(self._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2", "label": "__getitem__", "type": "function", "loc": [725, 732], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8195, 0.009, 1, 0.36, 0.5294, 698, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "__getitem__", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, item):\n \"\"\"returns a BlipRefs for the given slice.\"\"\"\n if isinstance(item, slice):\n if item.step:\n raise errors.Error('Step not supported for blip slices')\n return self.range(item.start, item.stop)\n else:\n return self.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L726_C4", "label": "expression", "type": "expression", "loc": [726, 726], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2", "vector": [8, 2, 0.8166, 0.0011, 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 BlipRefs for the given slice.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "label": "if", "type": "if", "loc": [727, 732], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2", "vector": [4, 2, 0.8206, 0.0067, 2, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, slice):\n if item.step:\n raise errors.Error('Step not supported for blip slices')\n return self.range(item.start, item.stop)\n else:\n return self.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L728_C6", "label": "if", "type": "if", "loc": [728, 729], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "vector": [4, 3, 0.8195, 0.0022, 3, 0.5, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item.step:\n raise errors.Error('Step not supported for blip slices')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L730_C6", "label": "return", "type": "return", "loc": [730, 730], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "vector": [13, 3, 0.8211, 0.0011, 3, 0.5, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.range(item.start, item.stop)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L732_C6", "label": "return", "type": "return", "loc": [732, 732], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "vector": [13, 3, 0.8234, 0.0011, 3, 0.5, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.at(item)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2", "label": "__setitem__", "type": "function", "loc": [734, 736], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8268, 0.0034, 1, 0.36, 0.5588, 343, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__setitem__", "arg_names": ["self", "item", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, item, value):\n \"\"\"short cut for self.range/at().replace(value).\"\"\"\n self.__getitem__(item).replace(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L735_C4", "label": "expression", "type": "expression", "loc": [735, 735], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2", "vector": [8, 2, 0.8268, 0.0011, 2, 0.89, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"short cut for self.range/at().replace(value).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L736_C4", "label": "replace()", "type": "expression", "loc": [736, 736], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2", "vector": [8, 2, 0.8279, 0.0011, 2, 0.89, 1.0, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " self.__getitem__(item).replace(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2", "label": "__delitem__", "type": "function", "loc": [738, 740], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8313, 0.0034, 1, 0.36, 0.5882, 66, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__delitem__", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, item):\n \"\"\"short cut for self.range/at().delete().\"\"\"\n self.__getitem__(item).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L739_C4", "label": "expression", "type": "expression", "loc": [739, 739], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2", "vector": [8, 2, 0.8313, 0.0011, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"short cut for self.range/at().delete().\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L740_C4", "label": "delete()", "type": "expression", "loc": [740, 740], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2", "vector": [8, 2, 0.8324, 0.0011, 2, 0.21, 1.0, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " self.__getitem__(item).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "label": "_shift", "type": "function", "loc": [742, 750], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8391, 0.0101, 1, 0.36, 0.6176, 613, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_shift", "arg_names": ["self", "where", "inc"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _shift(self, where, inc):\n \"\"\"Move element and annotations after 'where' up by 'inc'.\"\"\"\n new_elements = {}\n for idx, el in self._elements.items():\n if idx >= where:\n idx += inc\n new_elements[idx] = el\n self._elements = new_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L743_C4", "label": "expression", "type": "expression", "loc": [743, 743], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "vector": [8, 2, 0.8358, 0.0011, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Move element and annotations after 'where' up by 'inc'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L744_C4", "label": "new_elements =", "type": "assigned_variable", "loc": [744, 744], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "vector": [14, 2, 0.8369, 0.0011, 2, 0.7, 0.25, 700, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "new_elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_elements = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4", "label": "for idx, el", "type": "for", "loc": [745, 748], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "vector": [6, 2, 0.8397, 0.0045, 2, 0.7, 0.5, 946, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "idx, el", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for idx, el in self._elements.items():\n if idx >= where:\n idx += inc\n new_elements[idx] = el"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L746_C6", "label": "if", "type": "if", "loc": [746, 747], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4", "vector": [4, 3, 0.8397, 0.0022, 3, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if idx >= where:\n idx += inc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L748_C6", "label": "assign", "type": "assigned_variable", "loc": [748, 748], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4", "vector": [14, 3, 0.8414, 0.0011, 3, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_elements[idx] = el"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L749_C4", "label": "self._elements =", "type": "assigned_variable", "loc": [749, 749], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "vector": [14, 2, 0.8425, 0.0011, 2, 0.7, 0.75, 809, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._elements = new_elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L750_C4", "label": "_shift()", "type": "expression", "loc": [750, 750], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "vector": [8, 2, 0.8436, 0.0011, 2, 0.7, 1.0, 613, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_shift", "arg_names": [], "import_names": [], "rhs_call_name": "_shift", "annotation": ""}, "snippet": " self._annotations._shift(where, inc)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2", "label": "_delete_annotations", "type": "function", "loc": [752, 755], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8476, 0.0045, 1, 0.36, 0.6471, 741, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "_delete_annotations", "arg_names": ["self", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _delete_annotations(self, start, end):\n \"\"\"Delete all annotations between 'start' and 'end'.\"\"\"\n for annotation_name in self._annotations.names():\n self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L753_C4", "label": "expression", "type": "expression", "loc": [753, 753], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2", "vector": [8, 2, 0.847, 0.0011, 2, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Delete all annotations between 'start' and 'end'.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L754_C4", "label": "for annotation_name", "type": "for", "loc": [754, 755], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2", "vector": [6, 2, 0.8487, 0.0022, 2, 0.47, 1.0, 600, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "annotation_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for annotation_name in self._annotations.names():\n self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L755_C6", "label": "_delete_internal()", "type": "expression", "loc": [755, 755], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L754_C4", "vector": [8, 3, 0.8493, 0.0011, 3, 0.73, 0.0, 221, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_delete_internal", "arg_names": [], "import_names": [], "rhs_call_name": "_delete_internal", "annotation": ""}, "snippet": " self._annotations._delete_internal(annotation_name, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2", "label": "all", "type": "function", "loc": [757, 762], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8543, 0.0067, 1, 0.36, 0.6765, 895, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "all", "arg_names": ["self", "findwhat", "maxres", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def all(self, findwhat=None, maxres=-1, **restrictions):\n \"\"\"Returns a BlipRefs object representing all results for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\"\n return BlipRefs.all(self, findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L758_C4", "label": "expression", "type": "expression", "loc": [758, 761], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2", "vector": [8, 2, 0.8543, 0.0045, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns a BlipRefs object representing all results for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L762_C4", "label": "return", "type": "return", "loc": [762, 762], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2", "vector": [13, 2, 0.8571, 0.0011, 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 BlipRefs.all(self, findwhat, maxres, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2", "label": "first", "type": "function", "loc": [764, 769], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8622, 0.0067, 1, 0.36, 0.7059, 199, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "first", "arg_names": ["self", "findwhat", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def first(self, findwhat=None, **restrictions):\n \"\"\"Returns a BlipRefs object representing the first result for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\"\n return BlipRefs.all(self, findwhat, 1, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L765_C4", "label": "expression", "type": "expression", "loc": [765, 768], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2", "vector": [8, 2, 0.8622, 0.0045, 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 a BlipRefs object representing the first result for the search.\n If searching for an element, the restrictions can be used to specify\n additional element properties to filter on, like the url of a Gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L769_C4", "label": "return", "type": "return", "loc": [769, 769], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2", "vector": [13, 2, 0.865, 0.0011, 2, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return BlipRefs.all(self, findwhat, 1, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2", "label": "at", "type": "function", "loc": [771, 773], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8684, 0.0034, 1, 0.36, 0.7353, 296, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "at", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def at(self, index):\n \"\"\"Returns a BlipRefs object representing a 1-character range.\"\"\"\n return BlipRefs.range(self, index, index + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L772_C4", "label": "expression", "type": "expression", "loc": [772, 772], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2", "vector": [8, 2, 0.8684, 0.0011, 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 a BlipRefs object representing a 1-character range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L773_C4", "label": "return", "type": "return", "loc": [773, 773], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2", "vector": [13, 2, 0.8695, 0.0011, 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 BlipRefs.range(self, index, index + 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2", "label": "range", "type": "function", "loc": [775, 777], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8729, 0.0034, 1, 0.36, 0.7647, 816, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "range", "arg_names": ["self", "start", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def range(self, start, end):\n \"\"\"Returns a BlipRefs object representing the range.\"\"\"\n return BlipRefs.range(self, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L776_C4", "label": "expression", "type": "expression", "loc": [776, 776], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2", "vector": [8, 2, 0.8729, 0.0011, 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 a BlipRefs object representing the range.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L777_C4", "label": "return", "type": "return", "loc": [777, 777], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2", "vector": [13, 2, 0.874, 0.0011, 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 BlipRefs.range(self, start, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2", "label": "serialize", "type": "function", "loc": [779, 794], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.8847, 0.018, 1, 0.36, 0.7941, 50, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a dictionary representation of this blip ready for json.\"\"\"\n return {'blipId': self._blip_id,\n 'childBlipIds': list(self._child_blip_ids),\n 'content': self._content,\n 'creator': self._creator,\n 'contributors': list(self._contributors),\n 'lastModifiedTime': self._last_modified_time,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L780_C4", "label": "expression", "type": "expression", "loc": [780, 780], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2", "vector": [8, 2, 0.8774, 0.0011, 2, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a dictionary representation of this blip ready for json.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L781_C4", "label": "return", "type": "return", "loc": [781, 794], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2", "vector": [13, 2, 0.8858, 0.0157, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 6, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'blipId': self._blip_id,\n 'childBlipIds': list(self._child_blip_ids),\n 'content': self._content,\n 'creator': self._creator,\n 'contributors': list(self._contributors),\n 'lastModifiedTime': self._last_modified_time,\n 'version': self._version,\n 'parentBlipId': self._parent_blip_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "label": "proxy_for", "type": "function", "loc": [796, 822], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.91, 0.0304, 1, 0.36, 0.8235, 365, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy_for_id):\n \"\"\"Return a view on this blip that will proxy for the specified id.\n\n A shallow copy of the current blip is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L797_C4", "label": "expression", "type": "expression", "loc": [797, 803], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [8, 2, 0.8999, 0.0079, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a view on this blip that will proxy for the specified id.\n\n A shallow copy of the current blip is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L804_C4", "label": "operation_queue = proxy_for()", "type": "assigned_variable", "loc": [804, 804], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9044, 0.0011, 2, 0.24, 0.0588, 919, 3, 1, 0, 0, 365, 10, 1], "semantic": {"name": "operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "proxy_for", "annotation": ""}, "snippet": " operation_queue = self._operation_queue.proxy_for(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L805_C4", "label": "res = Blip()", "type": "assigned_variable", "loc": [805, 807], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9066, 0.0034, 2, 0.24, 0.1176, 413, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " res = Blip(json={},\n other_blips={},\n operation_queue=operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L808_C4", "label": "res._blip_id =", "type": "assigned_variable", "loc": [808, 808], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9089, 0.0011, 2, 0.24, 0.1765, 951, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._blip_id = self._blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L809_C4", "label": "res._child_blip_ids =", "type": "assigned_variable", "loc": [809, 809], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.91, 0.0011, 2, 0.24, 0.2353, 713, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._child_blip_ids", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._child_blip_ids = self._child_blip_ids"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L810_C4", "label": "res._content =", "type": "assigned_variable", "loc": [810, 810], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9111, 0.0011, 2, 0.24, 0.2941, 79, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._content = self._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L811_C4", "label": "res._contributors =", "type": "assigned_variable", "loc": [811, 811], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9123, 0.0011, 2, 0.24, 0.3529, 874, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._contributors", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._contributors = self._contributors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L812_C4", "label": "res._creator =", "type": "assigned_variable", "loc": [812, 812], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9134, 0.0011, 2, 0.24, 0.4118, 937, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creator = self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L813_C4", "label": "res._last_modified_time =", "type": "assigned_variable", "loc": [813, 813], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9145, 0.0011, 2, 0.24, 0.4706, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._last_modified_time = self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L814_C4", "label": "res._version =", "type": "assigned_variable", "loc": [814, 814], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9156, 0.0011, 2, 0.24, 0.5294, 547, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._version = self._version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L815_C4", "label": "res._parent_blip_id =", "type": "assigned_variable", "loc": [815, 815], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9168, 0.0011, 2, 0.24, 0.5882, 545, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._parent_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._parent_blip_id = self._parent_blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L816_C4", "label": "res._wave_id =", "type": "assigned_variable", "loc": [816, 816], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9179, 0.0011, 2, 0.24, 0.6471, 620, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wave_id = self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L817_C4", "label": "res._wavelet_id =", "type": "assigned_variable", "loc": [817, 817], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.919, 0.0011, 2, 0.24, 0.7059, 917, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wavelet_id = self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L818_C4", "label": "res._other_blips =", "type": "assigned_variable", "loc": [818, 818], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9201, 0.0011, 2, 0.24, 0.7647, 755, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._other_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._other_blips = self._other_blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L819_C4", "label": "res._annotations =", "type": "assigned_variable", "loc": [819, 819], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9213, 0.0011, 2, 0.24, 0.8235, 378, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._annotations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._annotations = self._annotations"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L820_C4", "label": "res._elements =", "type": "assigned_variable", "loc": [820, 820], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9224, 0.0011, 2, 0.24, 0.8824, 441, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._elements", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._elements = self._elements"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L821_C4", "label": "res.raw_data =", "type": "assigned_variable", "loc": [821, 821], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [14, 2, 0.9235, 0.0011, 2, 0.24, 0.9412, 278, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res.raw_data = self.raw_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L822_C4", "label": "return", "type": "return", "loc": [822, 822], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "vector": [13, 2, 0.9246, 0.0011, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2", "label": "text", "type": "function", "loc": [825, 827], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9291, 0.0034, 1, 0.36, 0.8529, 439, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def text(self):\n \"\"\"Returns the raw text content of this document.\"\"\"\n return self._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L826_C4", "label": "expression", "type": "expression", "loc": [826, 826], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2", "vector": [8, 2, 0.9291, 0.0011, 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 raw text content of this document.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L827_C4", "label": "return", "type": "return", "loc": [827, 827], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2", "vector": [13, 2, 0.9303, 0.0011, 2, 0.1, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "label": "find", "type": "function", "loc": [829, 840], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9387, 0.0135, 1, 0.36, 0.8824, 340, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "find", "arg_names": ["self", "what", "restrictions"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def find(self, what, **restrictions):\n \"\"\"Iterate to matching bits of contents.\n\n Yield either elements or pieces of text.\n \"\"\"\n br = BlipRefs.all(self, what, **restrictions)\n for start, end in br._hits():\n if end - start == 1 and start in self._elements:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L830_C4", "label": "expression", "type": "expression", "loc": [830, 833], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "vector": [8, 2, 0.9353, 0.0045, 2, 0.05, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Iterate to matching bits of contents.\n\n Yield either elements or pieces of text.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L834_C4", "label": "br = all()", "type": "assigned_variable", "loc": [834, 834], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "vector": [14, 2, 0.9381, 0.0011, 2, 0.05, 0.5, 199, 3, 3, 0, 0, 895, 10, 1], "semantic": {"name": "br", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " br = BlipRefs.all(self, what, **restrictions)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L835_C4", "label": "for start, end", "type": "for", "loc": [835, 839], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "vector": [6, 2, 0.9415, 0.0056, 2, 0.05, 1.0, 670, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in br._hits():\n if end - start == 1 and start in self._elements:\n yield self._elements[start]\n else:\n yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6", "label": "if", "type": "if", "loc": [836, 839], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L835_C4", "vector": [4, 3, 0.9421, 0.0045, 3, 0.9, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end - start == 1 and start in self._elements:\n yield self._elements[start]\n else:\n yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L837_C8", "label": "expression", "type": "expression", "loc": [837, 837], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6", "vector": [8, 4, 0.9415, 0.0011, 4, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._elements[start]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L839_C8", "label": "expression", "type": "expression", "loc": [839, 839], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6", "vector": [8, 4, 0.9438, 0.0011, 4, 0.14, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield self._content[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2", "label": "append", "type": "function", "loc": [842, 845], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9488, 0.0045, 1, 0.36, 0.9118, 243, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": ["self", "what", "bundled_annotations"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, what, bundled_annotations=None):\n \"\"\"Convenience method covering a common pattern.\"\"\"\n return BlipRefs.all(self, findwhat=None).insert_after(\n what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L843_C4", "label": "expression", "type": "expression", "loc": [843, 843], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2", "vector": [8, 2, 0.9483, 0.0011, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Convenience method covering a common pattern.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L844_C4", "label": "return", "type": "return", "loc": [844, 845], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2", "vector": [13, 2, 0.9499, 0.0022, 2, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return BlipRefs.all(self, findwhat=None).insert_after(\n what, bundled_annotations=bundled_annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "label": "reply", "type": "function", "loc": [847, 854], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9567, 0.009, 1, 0.36, 0.9412, 714, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "reply", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reply(self):\n \"\"\"Create and return a reply to this blip.\"\"\"\n blip_data = self._operation_queue.blip_create_child(self.wave_id,\n self.wavelet_id,\n self.blip_id)\n new_blip = Blip(blip_data, self._other_blips, self._operation_queue)\n self._other_blips._add(new_blip)\n return new_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L848_C4", "label": "expression", "type": "expression", "loc": [848, 848], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "vector": [8, 2, 0.9539, 0.0011, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create and return a reply to this blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L849_C4", "label": "blip_data = blip_create_child()", "type": "assigned_variable", "loc": [849, 851], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "vector": [14, 2, 0.9561, 0.0034, 2, 0.41, 0.25, 892, 3, 3, 0, 0, 643, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "blip_create_child", "annotation": ""}, "snippet": " blip_data = self._operation_queue.blip_create_child(self.wave_id,\n self.wavelet_id,\n self.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L852_C4", "label": "new_blip = Blip()", "type": "assigned_variable", "loc": [852, 852], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "vector": [14, 2, 0.9584, 0.0011, 2, 0.41, 0.5, 893, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " new_blip = Blip(blip_data, self._other_blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L853_C4", "label": "_add()", "type": "expression", "loc": [853, 853], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "vector": [8, 2, 0.9595, 0.0011, 2, 0.41, 0.75, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._other_blips._add(new_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L854_C4", "label": "return", "type": "return", "loc": [854, 854], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "vector": [13, 2, 0.9606, 0.0011, 2, 0.41, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "label": "append_markup", "type": "function", "loc": [856, 867], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9691, 0.0135, 1, 0.36, 0.9706, 513, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "append_markup", "arg_names": ["self", "markup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append_markup(self, markup):\n \"\"\"Interpret the markup text as xhtml and append the result to the doc.\n\n Args:\n markup: The markup'ed text to append.\n \"\"\"\n markup = util.force_unicode(markup)\n self._operation_queue.document_append_markup(self.wave_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L857_C4", "label": "expression", "type": "expression", "loc": [857, 861], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "vector": [8, 2, 0.9663, 0.0056, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Interpret the markup text as xhtml and append the result to the doc.\n\n Args:\n markup: The markup'ed text to append.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L862_C4", "label": "markup = force_unicode()", "type": "assigned_variable", "loc": [862, 862], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "vector": [14, 2, 0.9696, 0.0011, 2, 0.4, 0.5, 922, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "markup", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " markup = util.force_unicode(markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L863_C4", "label": "document_append_markup()", "type": "expression", "loc": [863, 866], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "vector": [8, 2, 0.9724, 0.0045, 2, 0.4, 1.0, 684, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "document_append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "document_append_markup", "annotation": ""}, "snippet": " self._operation_queue.document_append_markup(self.wave_id,\n self.wavelet_id,\n self.blip_id,\n markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "label": "insert_inline_blip", "type": "function", "loc": [869, 889], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "vector": [2, 1, 0.9888, 0.0236, 1, 0.36, 1.0, 203, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "insert_inline_blip", "arg_names": ["self", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def insert_inline_blip(self, position):\n \"\"\"Inserts an inline blip into this blip at a specific position.\n\n Args:\n position: Position to insert the blip at. This has to be greater than 0.\n\n Returns:\n The JSON data of the blip that was created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L870_C4", "label": "expression", "type": "expression", "loc": [870, 877], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [8, 2, 0.9826, 0.009, 2, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts an inline blip into this blip at a specific position.\n\n Args:\n position: Position to insert the blip at. This has to be greater than 0.\n\n Returns:\n The JSON data of the blip that was created.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L878_C4", "label": "if", "type": "if", "loc": [878, 880], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [4, 2, 0.9888, 0.0034, 2, 0.33, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if position <= 0:\n raise IndexError(('Illegal inline blip position: %d. Position has to ' +\n 'be greater than 0.') % position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L882_C4", "label": "blip_data = document_inline_blip_insert()", "type": "assigned_variable", "loc": [882, 886], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [14, 2, 0.9944, 0.0056, 2, 0.33, 0.4, 892, 3, 4, 0, 0, 243, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "document_inline_blip_insert", "annotation": ""}, "snippet": " blip_data = self._operation_queue.document_inline_blip_insert(\n self.wave_id,\n self.wavelet_id,\n self.blip_id,\n position)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L887_C4", "label": "new_blip = Blip()", "type": "assigned_variable", "loc": [887, 887], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [14, 2, 0.9978, 0.0011, 2, 0.33, 0.6, 893, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " new_blip = Blip(blip_data, self._other_blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L888_C4", "label": "_add()", "type": "expression", "loc": [888, 888], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [8, 2, 0.9989, 0.0011, 2, 0.33, 0.8, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._other_blips._add(new_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L889_C4", "label": "return", "type": "return", "loc": [889, 889], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "vector": [13, 2, 1.0, 0.0011, 2, 0.33, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return new_blip"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L68_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L78_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L107_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L108_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L108_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L110_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L109_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L115_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L118_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L118_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L119_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L112_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L121_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L121_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L122_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L124_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L125_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L127_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L132_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L134_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L137_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L139_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L138_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L143_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L144_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L145_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L146_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L147_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L148_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L155_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L155_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L152_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L161_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L164_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L166_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L171_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L169_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L175_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L175_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L176_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L162_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L179_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L181_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L181_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L184_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L184_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L187_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L189_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L189_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L192_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L207_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L207_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L213_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L213_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L216_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L219_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L226_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L224_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L227_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L227_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L231_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L246_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L247_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L252_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L265_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L266_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L268_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L269_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L270_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L271_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L282_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L283_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L286_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L288_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L290_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L292_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L289_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L293_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L284_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L294_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L278_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L298_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L308_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L309_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L310_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L311_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L311_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L336_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L315_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L339_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L340_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L344_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:While_L341_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L346_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L348_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L338_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L349_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L349_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L351_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L353_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L377_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L377_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L376_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L379_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L381_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L387_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L388_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L391_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L392_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L392_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L396_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L399_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L398_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L401_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L390_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L404_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L404_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L405_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L407_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L408_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L412_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L413_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L415_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L411_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L416_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L417_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L418_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L403_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L420_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L421_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L419_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L423_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L422_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L425_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L426_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L429_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L431_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L431_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L432_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L434_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L436_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L438_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L444_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L443_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L446_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L450_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L450_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L451_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L453_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L454_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L456_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L457_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L455_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L458_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L458_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L459_C14"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L461_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L461_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L462_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L465_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L466_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L468_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L471_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L471_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L472_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L474_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L475_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L475_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L478_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L477_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L482_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L482_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L484_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L484_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L486_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L485_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L488_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L490_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L491_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L489_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L492_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L492_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L493_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L494_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L494_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L495_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L497_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L356_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L499_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L501_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L501_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L502_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L501_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L503_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L507_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L506_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L508_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L511_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L513_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L517_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L516_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L518_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L521_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L528_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L527_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L530_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L520_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L531_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L534_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L533_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L542_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L543_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L543_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L544_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L541_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L545_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L547_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L547_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L547_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L549_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L549_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L551_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L550_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L553_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L557_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L556_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L569_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L568_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L573_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L572_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L574_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L251_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L576_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L576_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L577_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L577_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L578_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L582_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L593_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L602_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L603_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L604_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L605_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L606_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L607_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L608_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L609_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L610_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L611_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L612_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L614_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L613_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L616_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L617_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L619_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L618_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L620_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L624_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L626_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L626_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L627_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L592_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L628_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L632_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L631_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L637_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L636_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L638_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L642_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L641_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L643_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L646_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L648_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L652_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L651_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L653_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L658_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L657_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L659_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L663_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L662_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L664_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L668_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L667_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L669_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L673_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L672_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L674_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L678_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L677_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L679_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L683_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L682_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L685_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L689_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L694_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L695_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L695_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L696_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L697_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L697_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L698_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L698_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L699_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L688_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L700_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L703_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L702_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L704_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L708_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L707_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L709_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L713_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L712_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L720_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L722_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L722_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L723_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L726_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L725_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L728_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L730_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L727_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L732_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L735_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L734_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L736_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L739_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L738_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L740_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L743_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L744_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L746_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L745_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L748_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L749_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L742_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L750_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L753_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L752_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L754_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L754_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L755_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L758_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L757_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L762_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L765_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L764_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L769_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L772_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L771_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L773_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L776_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L775_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L777_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L780_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L779_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L781_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L797_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L804_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L805_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L808_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L809_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L810_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L811_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L812_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L813_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L814_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L815_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L816_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L817_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L818_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L819_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L820_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L821_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L796_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L822_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L826_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L825_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L827_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L830_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L834_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L829_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L835_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:For_L835_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L837_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L836_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L839_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L843_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L842_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L844_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L848_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L849_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L852_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L853_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L847_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L854_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L857_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L862_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L856_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L863_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:ClassDef_L581_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L870_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:If_L878_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L882_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Assign_L887_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Expr_L888_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1132:FunctionDef_L869_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1132:Return_L889_C4"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Elements are non-text bits living in blips like images, gadgets etc.
This module defines the Element class and the derived classes.
"""
import base64
import logging
import sys
import util
class Element(object):
"""Elements are non-text content within a document.
These are generally abstracted from the Robot. Although a Robot can query the
properties of an element it can only interact with the specific types that
the element represents.
Properties of elements are both accessible directly (image.url) and through
the properties dictionary (image.properties['url']). In general Element
should not be instantiated by robots, but rather rely on the derived classes.
"""
# INLINE_BLIP_TYPE is not a separate type since it shouldn't be instantiated,
# only be used for introspection
INLINE_BLIP_TYPE = "INLINE_BLIP"
def __init__(self, element_type, **properties):
"""Initializes self with the specified type and any properties.
Args:
element_type: string typed member of ELEMENT_TYPE
properties: either a dictionary of initial properties, or a dictionary
with just one member properties that is itself a dictionary of
properties. This allows us to both use
e = Element(atype, prop1=val1, prop2=prop2...)
and
e = Element(atype, properties={prop1:val1, prop2:prop2..})
"""
if len(properties) == 1 and 'properties' in properties:
properties = properties['properties']
self._type = element_type
# as long as the operation_queue of an element in None, it is
# unattached. After an element is acquired by a blip, the blip
# will set the operation_queue to make sure all changes to the
# element are properly send to the server.
self._operation_queue = None
self._properties = properties.copy()
@property
def type(self):
"""The type of this element."""
return self._type
@classmethod
def from_json(cls, json):
"""Class method to instantiate an Element based on a json string."""
etype = json['type']
props = json['properties'].copy()
element_class = ALL.get(etype)
if not element_class:
# Unknown type. Server could be newer than we are
return Element(element_type=etype, properties=props)
return element_class.from_props(props)
def get(self, key, default=None):
"""Standard get interface."""
return self._properties.get(key, default)
def __getattr__(self, key):
return self._properties[key]
def serialize(self):
"""Custom serializer for Elements."""
return util.serialize({'properties': util.non_none_dict(self._properties),
'type': self._type})
class Input(Element):
"""A single-line input element."""
class_type = 'INPUT'
def __init__(self, name, value=''):
super(Input, self).__init__(Input.class_type,
name=name,
value=value,
default_value=value)
@classmethod
def from_props(cls, props):
return Input(name=props.get('name'), value=props.get('value'))
class Check(Element):
"""A checkbox element."""
class_type = 'CHECK'
def __init__(self, name, value=''):
super(Check, self).__init__(Check.class_type,
name=name, value=value, default_value=value)
@classmethod
def from_props(cls, props):
return Check(name=props.get('name'), value=props.get('value'))
class Button(Element):
"""A button element."""
class_type = 'BUTTON'
def __init__(self, name, value):
super(Button, self).__init__(Button.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return Button(name=props.get('name'), value=props.get('value'))
class Label(Element):
"""A label element."""
class_type = 'LABEL'
def __init__(self, label_for, caption):
super(Label, self).__init__(Label.class_type,
name=label_for, value=caption)
@classmethod
def from_props(cls, props):
return Label(label_for=props.get('name'), caption=props.get('value'))
class RadioButton(Element):
"""A radio button element."""
class_type = 'RADIO_BUTTON'
def __init__(self, name, group):
super(RadioButton, self).__init__(RadioButton.class_type,
name=name, value=group)
@classmethod
def from_props(cls, props):
return RadioButton(name=props.get('name'), group=props.get('value'))
class RadioButtonGroup(Element):
"""A group of radio buttons."""
class_type = 'RADIO_BUTTON_GROUP'
def __init__(self, name, value):
super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return RadioButtonGroup(name=props.get('name'), value=props.get('value'))
class Password(Element):
"""A password element."""
class_type = 'PASSWORD'
def __init__(self, name, value):
super(Password, self).__init__(Password.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return Password(name=props.get('name'), value=props.get('value'))
class TextArea(Element):
"""A text area element."""
class_type = 'TEXTAREA'
def __init__(self, name, value):
super(TextArea, self).__init__(TextArea.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return TextArea(name=props.get('name'), value=props.get('value'))
class Line(Element):
"""A line element.
Note that Lines are represented in the text as newlines.
"""
class_type = 'LINE'
# Possible line types:
#: Designates line as H1, largest heading.
TYPE_H1 = 'h1'
#: Designates line as H2 heading.
TYPE_H2 = 'h2'
#: Designates line as H3 heading.
TYPE_H3 = 'h3'
#: Designates line as H4 heading.
TYPE_H4 = 'h4'
#: Designates line as H5, smallest heading.
TYPE_H5 = 'h5'
#: Designates line as a bulleted list item.
TYPE_LI = 'li'
# Possible values for align
#: Sets line alignment to left.
ALIGN_LEFT = 'l'
#: Sets line alignment to right.
ALIGN_RIGHT = 'r'
#: Sets line alignment to centered.
ALIGN_CENTER = 'c'
#: Sets line alignment to justified.
ALIGN_JUSTIFIED = 'j'
def __init__(self,
line_type=None,
indent=None,
alignment=None,
direction=None):
super(Line, self).__init__(Line.class_type,
lineType=line_type,
indent=indent,
alignment=alignment,
direction=direction)
@classmethod
def from_props(cls, props):
return Line(line_type=props.get('lineType'),
indent=props.get('indent'),
alignment=props.get('alignment'),
direction=props.get('direction'))
class Gadget(Element):
"""A gadget element."""
class_type = 'GADGET'
def __init__(self, url, props=None):
if props is None:
props = {}
props['url'] = url
super(Gadget, self).__init__(Gadget.class_type, properties=props)
@classmethod
def from_props(cls, props):
return Gadget(props.get('url'), props)
def serialize(self):
"""Gadgets allow for None values."""
return {'properties': self._properties, 'type': self._type}
def keys(self):
"""Get the valid keys for this gadget."""
return [x for x in self._properties.keys() if x != 'url']
class Installer(Element):
"""An installer element."""
class_type = 'INSTALLER'
def __init__(self, manifest):
super(Installer, self).__init__(Installer.class_type, manifest=manifest)
@classmethod
def from_props(cls, props):
return Installer(props.get('manifest'))
class Image(Element):
"""An image element."""
class_type = 'IMAGE'
def __init__(self, url='', width=None, height=None,
attachmentId=None, caption=None):
super(Image, self).__init__(Image.class_type, url=url, width=width,
height=height, attachmentId=attachmentId, caption=caption)
@classmethod
def from_props(cls, props):
props = dict([(key.encode('utf-8'), value)
for key, value in props.items()])
return apply(Image, [], props)
class Attachment(Element):
"""An attachment element.
To create a new attachment, caption and data are needed.
mimeType, attachmentId and attachmentUrl are sent via events.
"""
class_type = 'ATTACHMENT'
def __init__(self, caption=None, data=None, mimeType=None, attachmentId=None,
attachmentUrl=None):
Attachment.originalData = data
super(Attachment, self).__init__(Attachment.class_type, caption=caption,
data=data, mimeType=mimeType, attachmentId=attachmentId,
attachmentUrl=attachmentUrl)
def __getattr__(self, key):
if key and key == 'data':
return Attachment.originalData
return super(Attachment, self).__getattr__(key)
@classmethod
def from_props(cls, props):
props = dict([(key.encode('utf-8'), value)
for key, value in props.items()])
return apply(Attachment, [], props)
def serialize(self):
"""Serializes the attachment object into JSON.
The attachment data is base64 encoded.
"""
if self.data:
self._properties['data'] = base64.encodestring(self.data)
return super(Attachment, self).serialize()
def is_element(cls):
"""Returns whether the passed class is an element."""
try:
if not issubclass(cls, Element):
return False
h = hasattr(cls, 'class_type')
return hasattr(cls, 'class_type')
except TypeError:
return False
ALL = dict([(item.class_type, item) for item in globals().copy().values()
if is_element(item)])
| ajibawa-2023/Python-Code-Large/train/row_1133 | 165 | 367 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 20], "level": 0, "parent": null, "vector": [8, 0, 0.0504, 0.0109, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Elements are non-text bits living in blips like images, gadgets etc.\n\nThis module defines the Element class and the derived classes.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Import_L23_C0", "label": "base64 import base64", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0627, 0.0027, 0, 0.66, 0.05, 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_1133:Import_L24_C0", "label": "logging import logging", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0654, 0.0027, 0, 0.66, 0.1, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Import_L25_C0", "label": "sys import sys", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0681, 0.0027, 0, 0.66, 0.15, 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_1133:Import_L27_C0", "label": "util import util", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0736, 0.0027, 0, 0.66, 0.2, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "label": "Element", "type": "class", "loc": [30, 96], "level": 0, "parent": null, "vector": [3, 0, 0.1717, 0.1826, 0, 0.66, 0.25, 873, 0, 6, 0, 0, 186, 0, 9], "semantic": {"name": "Element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Element(object):\n \"\"\"Elements are non-text content within a document.\n\n These are generally abstracted from the Robot. Although a Robot can query the\n properties of an element it can only interact with the specific types that\n the element represents.\n\n Properties of elements are both accessible directly (image.url) and through"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [8, 1, 0.0967, 0.0272, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Elements are non-text content within a document.\n\n These are generally abstracted from the Robot. Although a Robot can query the\n properties of an element it can only interact with the specific types that\n the element represents.\n\n Properties of elements are both accessible directly (image.url) and through\n the properties dictionary (image.properties['url']). In general Element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L44_C2", "label": "INLINE_BLIP_TYPE =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [14, 1, 0.1199, 0.0027, 1, 0.73, 0.1429, 568, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INLINE_BLIP_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INLINE_BLIP_TYPE = \"INLINE_BLIP\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "label": "__init__", "type": "function", "loc": [46, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.1526, 0.0572, 1, 0.73, 0.2857, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "element_type", "properties"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, element_type, **properties):\n \"\"\"Initializes self with the specified type and any properties.\n\n Args:\n element_type: string typed member of ELEMENT_TYPE\n properties: either a dictionary of initial properties, or a dictionary\n with just one member properties that is itself a dictionary of\n properties. This allows us to both use"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "vector": [8, 2, 0.1417, 0.03, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes self with the specified type and any properties.\n\n Args:\n element_type: string typed member of ELEMENT_TYPE\n properties: either a dictionary of initial properties, or a dictionary\n with just one member properties that is itself a dictionary of\n properties. This allows us to both use\n e = Element(atype, prop1=val1, prop2=prop2...)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "vector": [4, 2, 0.1594, 0.0054, 2, 0.24, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(properties) == 1 and 'properties' in properties:\n properties = properties['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L59_C6", "label": "properties =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L58_C4", "vector": [14, 3, 0.1608, 0.0027, 3, 0.6, 0.0, 147, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "properties", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " properties = properties['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L60_C4", "label": "self._type =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "vector": [14, 2, 0.1635, 0.0027, 2, 0.24, 0.5, 313, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._type = element_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L65_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "vector": [14, 2, 0.1771, 0.0027, 2, 0.24, 0.75, 689, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L66_C4", "label": "self._properties = copy()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "vector": [14, 2, 0.1798, 0.0027, 2, 0.24, 1.0, 400, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "self._properties", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self._properties = properties.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2", "label": "type", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.1907, 0.0082, 1, 0.73, 0.4286, 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 \"\"\"The type of this element.\"\"\"\n return self._type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2", "vector": [8, 2, 0.1907, 0.0027, 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 type of this element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L71_C4", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2", "vector": [13, 2, 0.1935, 0.0027, 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._type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "label": "from_json", "type": "function", "loc": [74, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.2153, 0.03, 1, 0.73, 0.5714, 975, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_json", "arg_names": ["cls", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_json(cls, json):\n \"\"\"Class method to instantiate an Element based on a json string.\"\"\"\n etype = json['type']\n props = json['properties'].copy()\n\n element_class = ALL.get(etype)\n if not element_class:\n # Unknown type. Server could be newer than we are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L75_C4", "label": "expression", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [8, 2, 0.2044, 0.0027, 2, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class method to instantiate an Element based on a json string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L76_C4", "label": "etype =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [14, 2, 0.2071, 0.0027, 2, 0.53, 0.2, 370, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "etype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " etype = json['type']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L77_C4", "label": "props = copy()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [14, 2, 0.2098, 0.0027, 2, 0.53, 0.4, 675, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " props = json['properties'].copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L79_C4", "label": "element_class = get()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [14, 2, 0.2153, 0.0027, 2, 0.53, 0.6, 249, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "element_class", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " element_class = ALL.get(etype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L80_C4", "label": "if", "type": "if", "loc": [80, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [4, 2, 0.2207, 0.0082, 2, 0.53, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element_class:\n # Unknown type. Server could be newer than we are\n return Element(element_type=etype, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L82_C6", "label": "return", "type": "return", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L80_C4", "vector": [13, 3, 0.2234, 0.0027, 3, 0.12, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Element(element_type=etype, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "vector": [13, 2, 0.2289, 0.0027, 2, 0.53, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return element_class.from_props(props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2", "label": "get", "type": "function", "loc": [86, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.2371, 0.0082, 1, 0.73, 0.7143, 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 \"\"\"Standard get interface.\"\"\"\n return self._properties.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L87_C4", "label": "expression", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2", "vector": [8, 2, 0.2371, 0.0027, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Standard get interface.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L88_C4", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2", "vector": [13, 2, 0.2398, 0.0027, 2, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._properties.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L90_C2", "label": "__getattr__", "type": "function", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.2466, 0.0054, 1, 0.73, 0.8571, 210, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n return self._properties[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L90_C2", "vector": [13, 2, 0.248, 0.0027, 2, 0.52, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._properties[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2", "label": "serialize", "type": "function", "loc": [93, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "vector": [2, 1, 0.2575, 0.0109, 1, 0.73, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Custom serializer for Elements.\"\"\"\n return util.serialize({'properties': util.non_none_dict(self._properties),\n 'type': self._type})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2", "vector": [8, 2, 0.2561, 0.0027, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Custom serializer for Elements.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L95_C4", "label": "return", "type": "return", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2", "vector": [13, 2, 0.2602, 0.0054, 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 util.serialize({'properties': util.non_none_dict(self._properties),\n 'type': self._type})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "label": "Input", "type": "class", "loc": [99, 112], "level": 0, "parent": null, "vector": [3, 0, 0.2875, 0.0381, 0, 0.66, 0.3, 35, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Input", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Input(Element):\n \"\"\"A single-line input element.\"\"\"\n\n class_type = 'INPUT'\n\n def __init__(self, name, value=''):\n super(Input, self).__init__(Input.class_type,\n name=name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L100_C2", "label": "expression", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "vector": [8, 1, 0.2725, 0.0027, 1, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A single-line input element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L102_C2", "label": "class_type =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "vector": [14, 1, 0.2779, 0.0027, 1, 0.35, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'INPUT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L104_C2", "label": "__init__", "type": "function", "loc": [104, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "vector": [2, 1, 0.2888, 0.0136, 1, 0.35, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value=''):\n super(Input, self).__init__(Input.class_type,\n name=name,\n value=value,\n default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L105_C4", "label": "__init__()", "type": "expression", "loc": [105, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L104_C2", "vector": [8, 2, 0.2902, 0.0109, 2, 0.55, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Input, self).__init__(Input.class_type,\n name=name,\n value=value,\n default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L111_C2", "label": "from_props", "type": "function", "loc": [111, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "vector": [2, 1, 0.3038, 0.0054, 1, 0.35, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Input(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L111_C2", "vector": [13, 2, 0.3052, 0.0027, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Input(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "label": "Check", "type": "class", "loc": [115, 126], "level": 0, "parent": null, "vector": [3, 0, 0.3283, 0.0327, 0, 0.66, 0.35, 153, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Check(Element):\n \"\"\"A checkbox element.\"\"\"\n\n class_type = 'CHECK'\n\n def __init__(self, name, value=''):\n super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L116_C2", "label": "expression", "type": "expression", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "vector": [8, 1, 0.3161, 0.0027, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A checkbox element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L118_C2", "label": "class_type =", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "vector": [14, 1, 0.3215, 0.0027, 1, 0.04, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'CHECK'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L120_C2", "label": "__init__", "type": "function", "loc": [120, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "vector": [2, 1, 0.3297, 0.0082, 1, 0.04, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value=''):\n super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L121_C4", "label": "__init__()", "type": "expression", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L120_C2", "vector": [8, 2, 0.3311, 0.0054, 2, 0.78, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L125_C2", "label": "from_props", "type": "function", "loc": [125, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "vector": [2, 1, 0.342, 0.0054, 1, 0.04, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Check(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L126_C4", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L125_C2", "vector": [13, 2, 0.3433, 0.0027, 2, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Check(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "label": "Button", "type": "class", "loc": [129, 140], "level": 0, "parent": null, "vector": [3, 0, 0.3665, 0.0327, 0, 0.66, 0.4, 608, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Button", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Button(Element):\n \"\"\"A button element.\"\"\"\n\n class_type = 'BUTTON'\n\n def __init__(self, name, value):\n super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L130_C2", "label": "expression", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "vector": [8, 1, 0.3542, 0.0027, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A button element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L132_C2", "label": "class_type =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "vector": [14, 1, 0.3597, 0.0027, 1, 0.67, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'BUTTON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L134_C2", "label": "__init__", "type": "function", "loc": [134, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "vector": [2, 1, 0.3678, 0.0082, 1, 0.67, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L135_C4", "label": "__init__()", "type": "expression", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L134_C2", "vector": [8, 2, 0.3692, 0.0054, 2, 0.48, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L139_C2", "label": "from_props", "type": "function", "loc": [139, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "vector": [2, 1, 0.3801, 0.0054, 1, 0.67, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Button(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L140_C4", "label": "return", "type": "return", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L139_C2", "vector": [13, 2, 0.3815, 0.0027, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Button(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "label": "Label", "type": "class", "loc": [143, 154], "level": 0, "parent": null, "vector": [3, 0, 0.4046, 0.0327, 0, 0.66, 0.45, 413, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Label", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Label(Element):\n \"\"\"A label element.\"\"\"\n\n class_type = 'LABEL'\n\n def __init__(self, label_for, caption):\n super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L144_C2", "label": "expression", "type": "expression", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "vector": [8, 1, 0.3924, 0.0027, 1, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A label element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L146_C2", "label": "class_type =", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "vector": [14, 1, 0.3978, 0.0027, 1, 0.12, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'LABEL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L148_C2", "label": "__init__", "type": "function", "loc": [148, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "vector": [2, 1, 0.406, 0.0082, 1, 0.12, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "label_for", "caption"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, label_for, caption):\n super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L149_C4", "label": "__init__()", "type": "expression", "loc": [149, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L148_C2", "vector": [8, 2, 0.4074, 0.0054, 2, 0.29, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L153_C2", "label": "from_props", "type": "function", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "vector": [2, 1, 0.4183, 0.0054, 1, 0.12, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Label(label_for=props.get('name'), caption=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L154_C4", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L153_C2", "vector": [13, 2, 0.4196, 0.0027, 2, 0.97, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Label(label_for=props.get('name'), caption=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "label": "RadioButton", "type": "class", "loc": [157, 168], "level": 0, "parent": null, "vector": [3, 0, 0.4428, 0.0327, 0, 0.66, 0.5, 536, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "RadioButton", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RadioButton(Element):\n \"\"\"A radio button element.\"\"\"\n\n class_type = 'RADIO_BUTTON'\n\n def __init__(self, name, group):\n super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L158_C2", "label": "expression", "type": "expression", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "vector": [8, 1, 0.4305, 0.0027, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A radio button element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L160_C2", "label": "class_type =", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "vector": [14, 1, 0.436, 0.0027, 1, 0.95, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'RADIO_BUTTON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L162_C2", "label": "__init__", "type": "function", "loc": [162, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "vector": [2, 1, 0.4441, 0.0082, 1, 0.95, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "group"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, group):\n super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L163_C4", "label": "__init__()", "type": "expression", "loc": [163, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L162_C2", "vector": [8, 2, 0.4455, 0.0054, 2, 0.22, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L167_C2", "label": "from_props", "type": "function", "loc": [167, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "vector": [2, 1, 0.4564, 0.0054, 1, 0.95, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return RadioButton(name=props.get('name'), group=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L168_C4", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L167_C2", "vector": [13, 2, 0.4578, 0.0027, 2, 0.06, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RadioButton(name=props.get('name'), group=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "label": "RadioButtonGroup", "type": "class", "loc": [171, 182], "level": 0, "parent": null, "vector": [3, 0, 0.4809, 0.0327, 0, 0.66, 0.55, 254, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "RadioButtonGroup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RadioButtonGroup(Element):\n \"\"\"A group of radio buttons.\"\"\"\n\n class_type = 'RADIO_BUTTON_GROUP'\n\n def __init__(self, name, value):\n super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L172_C2", "label": "expression", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "vector": [8, 1, 0.4687, 0.0027, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A group of radio buttons.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L174_C2", "label": "class_type =", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "vector": [14, 1, 0.4741, 0.0027, 1, 0.26, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'RADIO_BUTTON_GROUP'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L176_C2", "label": "__init__", "type": "function", "loc": [176, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "vector": [2, 1, 0.4823, 0.0082, 1, 0.26, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L177_C4", "label": "__init__()", "type": "expression", "loc": [177, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L176_C2", "vector": [8, 2, 0.4837, 0.0054, 2, 0.11, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L181_C2", "label": "from_props", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "vector": [2, 1, 0.4946, 0.0054, 1, 0.26, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return RadioButtonGroup(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L181_C2", "vector": [13, 2, 0.4959, 0.0027, 2, 0.5, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RadioButtonGroup(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "label": "Password", "type": "class", "loc": [185, 196], "level": 0, "parent": null, "vector": [3, 0, 0.5191, 0.0327, 0, 0.66, 0.6, 113, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Password(Element):\n \"\"\"A password element.\"\"\"\n\n class_type = 'PASSWORD'\n\n def __init__(self, name, value):\n super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L186_C2", "label": "expression", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "vector": [8, 1, 0.5068, 0.0027, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A password element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L188_C2", "label": "class_type =", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "vector": [14, 1, 0.5123, 0.0027, 1, 0.75, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'PASSWORD'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L190_C2", "label": "__init__", "type": "function", "loc": [190, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "vector": [2, 1, 0.5204, 0.0082, 1, 0.75, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L191_C4", "label": "__init__()", "type": "expression", "loc": [191, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L190_C2", "vector": [8, 2, 0.5218, 0.0054, 2, 0.78, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L195_C2", "label": "from_props", "type": "function", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "vector": [2, 1, 0.5327, 0.0054, 1, 0.75, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Password(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L196_C4", "label": "return", "type": "return", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L195_C2", "vector": [13, 2, 0.5341, 0.0027, 2, 0.73, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Password(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "label": "TextArea", "type": "class", "loc": [199, 210], "level": 0, "parent": null, "vector": [3, 0, 0.5572, 0.0327, 0, 0.66, 0.65, 69, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "TextArea", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TextArea(Element):\n \"\"\"A text area element.\"\"\"\n\n class_type = 'TEXTAREA'\n\n def __init__(self, name, value):\n super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L200_C2", "label": "expression", "type": "expression", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "vector": [8, 1, 0.545, 0.0027, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A text area element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L202_C2", "label": "class_type =", "type": "assigned_variable", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "vector": [14, 1, 0.5504, 0.0027, 1, 0.13, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'TEXTAREA'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L204_C2", "label": "__init__", "type": "function", "loc": [204, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "vector": [2, 1, 0.5586, 0.0082, 1, 0.13, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L205_C4", "label": "__init__()", "type": "expression", "loc": [205, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L204_C2", "vector": [8, 2, 0.5599, 0.0054, 2, 0.93, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L209_C2", "label": "from_props", "type": "function", "loc": [209, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "vector": [2, 1, 0.5708, 0.0054, 1, 0.13, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return TextArea(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L210_C4", "label": "return", "type": "return", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L209_C2", "vector": [13, 2, 0.5722, 0.0027, 2, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return TextArea(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "label": "Line", "type": "class", "loc": [213, 261], "level": 0, "parent": null, "vector": [3, 0, 0.6458, 0.1335, 0, 0.66, 0.7, 650, 0, 2, 0, 0, 873, 0, 7], "semantic": {"name": "Line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Line(Element):\n \"\"\"A line element.\n \n Note that Lines are represented in the text as newlines.\n \"\"\"\n\n class_type = 'LINE'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L214_C2", "label": "expression", "type": "expression", "loc": [214, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [8, 1, 0.5872, 0.0109, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A line element.\n \n Note that Lines are represented in the text as newlines.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L219_C2", "label": "class_type =", "type": "assigned_variable", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.5967, 0.0027, 1, 0.15, 0.0769, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'LINE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L223_C2", "label": "TYPE_H1 =", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6076, 0.0027, 1, 0.15, 0.1538, 970, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H1 = 'h1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L225_C2", "label": "TYPE_H2 =", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6131, 0.0027, 1, 0.15, 0.2308, 383, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H2 = 'h2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L227_C2", "label": "TYPE_H3 =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6185, 0.0027, 1, 0.15, 0.3077, 794, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H3 = 'h3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L229_C2", "label": "TYPE_H4 =", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.624, 0.0027, 1, 0.15, 0.3846, 947, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H4", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H4 = 'h4'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L231_C2", "label": "TYPE_H5 =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6294, 0.0027, 1, 0.15, 0.4615, 476, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H5", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H5 = 'h5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L233_C2", "label": "TYPE_LI =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6349, 0.0027, 1, 0.15, 0.5385, 347, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_LI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_LI = 'li'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L237_C2", "label": "ALIGN_LEFT =", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6458, 0.0027, 1, 0.15, 0.6154, 917, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_LEFT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_LEFT = 'l'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L239_C2", "label": "ALIGN_RIGHT =", "type": "assigned_variable", "loc": [239, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6512, 0.0027, 1, 0.15, 0.6923, 971, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_RIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_RIGHT = 'r'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L241_C2", "label": "ALIGN_CENTER =", "type": "assigned_variable", "loc": [241, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6567, 0.0027, 1, 0.15, 0.7692, 448, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_CENTER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_CENTER = 'c'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L243_C2", "label": "ALIGN_JUSTIFIED =", "type": "assigned_variable", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [14, 1, 0.6621, 0.0027, 1, 0.15, 0.8462, 400, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_JUSTIFIED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_JUSTIFIED = 'j'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L245_C2", "label": "__init__", "type": "function", "loc": [245, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [2, 1, 0.6798, 0.0272, 1, 0.15, 0.9231, 555, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "line_type", "indent", "alignment", "direction"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n line_type=None,\n indent=None,\n alignment=None,\n direction=None):\n super(Line, self).__init__(Line.class_type,\n lineType=line_type,\n indent=indent,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L250_C4", "label": "__init__()", "type": "expression", "loc": [250, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L245_C2", "vector": [8, 2, 0.6866, 0.0136, 2, 0.22, 0.0, 555, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Line, self).__init__(Line.class_type,\n lineType=line_type,\n indent=indent,\n alignment=alignment,\n direction=direction)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L257_C2", "label": "from_props", "type": "function", "loc": [257, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "vector": [2, 1, 0.7057, 0.0136, 1, 0.15, 1.0, 559, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Line(line_type=props.get('lineType'),\n indent=props.get('indent'),\n alignment=props.get('alignment'),\n direction=props.get('direction'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L257_C2", "vector": [13, 2, 0.7071, 0.0109, 2, 0.83, 0.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Line(line_type=props.get('lineType'),\n indent=props.get('indent'),\n alignment=props.get('alignment'),\n direction=props.get('direction'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "label": "Gadget", "type": "class", "loc": [264, 285], "level": 0, "parent": null, "vector": [3, 0, 0.748, 0.0599, 0, 0.66, 0.75, 136, 0, 4, 0, 0, 873, 0, 5], "semantic": {"name": "Gadget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Gadget(Element):\n \"\"\"A gadget element.\"\"\"\n\n class_type = 'GADGET'\n\n def __init__(self, url, props=None):\n if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L265_C2", "label": "expression", "type": "expression", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [8, 1, 0.7221, 0.0027, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A gadget element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L267_C2", "label": "class_type =", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [14, 1, 0.7275, 0.0027, 1, 0.82, 0.2, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'GADGET'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "label": "__init__", "type": "function", "loc": [269, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [2, 1, 0.7384, 0.0136, 1, 0.82, 0.4, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "url", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, url, props=None):\n if props is None:\n props = {}\n props['url'] = url\n super(Gadget, self).__init__(Gadget.class_type, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L270_C4", "label": "if", "type": "if", "loc": [270, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "vector": [4, 2, 0.7371, 0.0054, 2, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L271_C6", "label": "props =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L270_C4", "vector": [14, 3, 0.7384, 0.0027, 3, 0.5, 0.0, 675, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L272_C4", "label": "assign", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "vector": [14, 2, 0.7411, 0.0027, 2, 0.33, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['url'] = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L273_C4", "label": "__init__()", "type": "expression", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "vector": [8, 2, 0.7439, 0.0027, 2, 0.33, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Gadget, self).__init__(Gadget.class_type, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L276_C2", "label": "from_props", "type": "function", "loc": [276, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [2, 1, 0.7534, 0.0054, 1, 0.82, 0.6, 559, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Gadget(props.get('url'), props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L277_C4", "label": "return", "type": "return", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L276_C2", "vector": [13, 2, 0.7548, 0.0027, 2, 0.66, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Gadget(props.get('url'), props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2", "label": "serialize", "type": "function", "loc": [279, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [2, 1, 0.7629, 0.0082, 1, 0.82, 0.8, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Gadgets allow for None values.\"\"\"\n return {'properties': self._properties, 'type': self._type}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L280_C4", "label": "expression", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2", "vector": [8, 2, 0.7629, 0.0027, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Gadgets allow for None values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L281_C4", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2", "vector": [13, 2, 0.7657, 0.0027, 2, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'properties': self._properties, 'type': self._type}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2", "label": "keys", "type": "function", "loc": [283, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "vector": [2, 1, 0.7738, 0.0082, 1, 0.82, 1.0, 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 \"\"\"Get the valid keys for this gadget.\"\"\"\n return [x for x in self._properties.keys() if x != 'url']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2", "vector": [8, 2, 0.7738, 0.0027, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get the valid keys for this gadget.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L285_C4", "label": "return", "type": "return", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2", "vector": [13, 2, 0.7766, 0.0027, 2, 0.32, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [x for x in self._properties.keys() if x != 'url']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "label": "Installer", "type": "class", "loc": [288, 298], "level": 0, "parent": null, "vector": [3, 0, 0.7984, 0.03, 0, 0.66, 0.8, 426, 0, 2, 0, 0, 873, 0, 4], "semantic": {"name": "Installer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Installer(Element):\n \"\"\"An installer element.\"\"\"\n\n class_type = 'INSTALLER'\n\n def __init__(self, manifest):\n super(Installer, self).__init__(Installer.class_type, manifest=manifest)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L289_C2", "label": "expression", "type": "expression", "loc": [289, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "vector": [8, 1, 0.7875, 0.0027, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An installer element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L291_C2", "label": "class_type =", "type": "assigned_variable", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "vector": [14, 1, 0.7929, 0.0027, 1, 0.45, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'INSTALLER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L293_C2", "label": "__init__", "type": "function", "loc": [293, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "vector": [2, 1, 0.7997, 0.0054, 1, 0.45, 0.6667, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "manifest"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, manifest):\n super(Installer, self).__init__(Installer.class_type, manifest=manifest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L294_C4", "label": "__init__()", "type": "expression", "loc": [294, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L293_C2", "vector": [8, 2, 0.8011, 0.0027, 2, 0.99, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Installer, self).__init__(Installer.class_type, manifest=manifest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L297_C2", "label": "from_props", "type": "function", "loc": [297, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "vector": [2, 1, 0.8106, 0.0054, 1, 0.45, 1.0, 559, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Installer(props.get('manifest'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L298_C4", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L297_C2", "vector": [13, 2, 0.812, 0.0027, 2, 0.93, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Installer(props.get('manifest'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "label": "Image", "type": "class", "loc": [302, 316], "level": 0, "parent": null, "vector": [3, 0, 0.842, 0.0409, 0, 0.66, 0.85, 721, 0, 2, 0, 0, 873, 0, 6], "semantic": {"name": "Image", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Image(Element):\n \"\"\"An image element.\"\"\"\n\n class_type = 'IMAGE'\n\n def __init__(self, url='', width=None, height=None,\n attachmentId=None, caption=None):\n super(Image, self).__init__(Image.class_type, url=url, width=width,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L303_C2", "label": "expression", "type": "expression", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "vector": [8, 1, 0.8256, 0.0027, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An image element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L305_C2", "label": "class_type =", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "vector": [14, 1, 0.8311, 0.0027, 1, 0.87, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'IMAGE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L307_C2", "label": "__init__", "type": "function", "loc": [307, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "vector": [2, 1, 0.8406, 0.0109, 1, 0.87, 0.6667, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "url", "width", "height", "attachmentId", "caption"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, url='', width=None, height=None,\n attachmentId=None, caption=None):\n super(Image, self).__init__(Image.class_type, url=url, width=width,\n height=height, attachmentId=attachmentId, caption=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L309_C4", "label": "__init__()", "type": "expression", "loc": [309, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L307_C2", "vector": [8, 2, 0.8433, 0.0054, 2, 0.67, 0.0, 555, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Image, self).__init__(Image.class_type, url=url, width=width,\n height=height, attachmentId=attachmentId, caption=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2", "label": "from_props", "type": "function", "loc": [313, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "vector": [2, 1, 0.8569, 0.0109, 1, 0.87, 1.0, 559, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])\n return apply(Image, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L314_C4", "label": "props = dict()", "type": "assigned_variable", "loc": [314, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2", "vector": [14, 2, 0.8569, 0.0054, 2, 0.32, 0.0, 675, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2", "vector": [13, 2, 0.861, 0.0027, 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 apply(Image, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "label": "Attachment", "type": "class", "loc": [318, 353], "level": 0, "parent": null, "vector": [3, 0, 0.9142, 0.0981, 0, 0.66, 0.9, 312, 0, 4, 0, 0, 873, 0, 11], "semantic": {"name": "Attachment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Attachment(Element):\n \"\"\"An attachment element.\n\n To create a new attachment, caption and data are needed.\n mimeType, attachmentId and attachmentUrl are sent via events.\n \"\"\"\n\n class_type = 'ATTACHMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L319_C2", "label": "expression", "type": "expression", "loc": [319, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [8, 1, 0.8747, 0.0136, 1, 0.86, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An attachment element.\n\n To create a new attachment, caption and data are needed.\n mimeType, attachmentId and attachmentUrl are sent via events.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L325_C2", "label": "class_type =", "type": "assigned_variable", "loc": [325, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [14, 1, 0.8856, 0.0027, 1, 0.86, 0.2, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'ATTACHMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2", "label": "__init__", "type": "function", "loc": [327, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [2, 1, 0.8978, 0.0163, 1, 0.86, 0.4, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "caption", "data", "mimeType", "attachmentId", "attachmentUrl"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, caption=None, data=None, mimeType=None, attachmentId=None,\n attachmentUrl=None):\n Attachment.originalData = data\n super(Attachment, self).__init__(Attachment.class_type, caption=caption,\n data=data, mimeType=mimeType, attachmentId=attachmentId,\n attachmentUrl=attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L329_C4", "label": "Attachment.originalData =", "type": "assigned_variable", "loc": [329, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2", "vector": [14, 2, 0.8965, 0.0027, 2, 0.32, 0.0, 667, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Attachment.originalData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Attachment.originalData = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L330_C4", "label": "__init__()", "type": "expression", "loc": [330, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2", "vector": [8, 2, 0.9019, 0.0082, 2, 0.32, 1.0, 555, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Attachment, self).__init__(Attachment.class_type, caption=caption,\n data=data, mimeType=mimeType, attachmentId=attachmentId,\n attachmentUrl=attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2", "label": "__getattr__", "type": "function", "loc": [334, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [2, 1, 0.9142, 0.0109, 1, 0.86, 0.6, 210, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n if key and key == 'data':\n return Attachment.originalData\n return super(Attachment, self).__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L335_C4", "label": "if", "type": "if", "loc": [335, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2", "vector": [4, 2, 0.9142, 0.0054, 2, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key and key == 'data':\n return Attachment.originalData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L336_C6", "label": "return", "type": "return", "loc": [336, 336], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L335_C4", "vector": [13, 3, 0.9155, 0.0027, 3, 0.3, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Attachment.originalData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L337_C4", "label": "return", "type": "return", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2", "vector": [13, 2, 0.9183, 0.0027, 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 super(Attachment, self).__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2", "label": "from_props", "type": "function", "loc": [340, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [2, 1, 0.9305, 0.0109, 1, 0.86, 0.8, 559, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])\n return apply(Attachment, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L341_C4", "label": "props = dict()", "type": "assigned_variable", "loc": [341, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2", "vector": [14, 2, 0.9305, 0.0054, 2, 0.13, 0.0, 675, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L343_C4", "label": "return", "type": "return", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2", "vector": [13, 2, 0.9346, 0.0027, 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 apply(Attachment, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "label": "serialize", "type": "function", "loc": [345, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "vector": [2, 1, 0.951, 0.0245, 1, 0.86, 1.0, 50, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the attachment object into JSON.\n\n The attachment data is base64 encoded.\n \"\"\"\n\n if self.data:\n self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L346_C4", "label": "expression", "type": "expression", "loc": [346, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "vector": [8, 2, 0.9469, 0.0109, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the attachment object into JSON.\n\n The attachment data is base64 encoded.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L351_C4", "label": "if", "type": "if", "loc": [351, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "vector": [4, 2, 0.9578, 0.0054, 2, 0.52, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.data:\n self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L352_C6", "label": " = encodestring()", "type": "assigned_variable", "loc": [352, 352], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L351_C4", "vector": [14, 3, 0.9591, 0.0027, 3, 0.8, 0.0, 0, 3, 1, 0, 0, 133, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "encodestring", "annotation": ""}, "snippet": " self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L353_C4", "label": "return", "type": "return", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "vector": [13, 2, 0.9619, 0.0027, 2, 0.52, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return super(Attachment, self).serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L356_C0", "label": "is_element", "type": "function", "loc": [356, 364], "level": 0, "parent": null, "vector": [2, 0, 0.9809, 0.0245, 0, 0.66, 0.95, 780, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "is_element", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_element(cls):\n \"\"\"Returns whether the passed class is an element.\"\"\"\n try:\n if not issubclass(cls, Element):\n return False\n h = hasattr(cls, 'class_type')\n return hasattr(cls, 'class_type')\n except TypeError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L357_C2", "label": "expression", "type": "expression", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L356_C0", "vector": [8, 1, 0.9728, 0.0027, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns whether the passed class is an element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "label": "try", "type": "try", "loc": [358, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L356_C0", "vector": [7, 1, 0.9837, 0.0191, 1, 0.93, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if not issubclass(cls, Element):\n return False\n h = hasattr(cls, 'class_type')\n return hasattr(cls, 'class_type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L359_C4", "label": "if", "type": "if", "loc": [359, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "vector": [4, 2, 0.9796, 0.0054, 2, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not issubclass(cls, Element):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L360_C6", "label": "return", "type": "return", "loc": [360, 360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L359_C4", "vector": [13, 3, 0.9809, 0.0027, 3, 0.61, 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_1133:Assign_L361_C4", "label": "h = hasattr()", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "vector": [14, 2, 0.9837, 0.0027, 2, 0.58, 0.5, 686, 3, 2, 0, 0, 720, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "hasattr", "annotation": ""}, "snippet": " h = hasattr(cls, 'class_type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L362_C4", "label": "return", "type": "return", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "vector": [13, 2, 0.9864, 0.0027, 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 hasattr(cls, 'class_type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L364_C4", "label": "return", "type": "return", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "vector": [13, 2, 0.9918, 0.0027, 2, 0.58, 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_1133:Assign_L366_C0", "label": "ALL = dict()", "type": "assigned_variable", "loc": [366, 367], "level": 0, "parent": null, "vector": [14, 0, 0.9986, 0.0054, 0, 0.66, 1.0, 431, 3, 1, 0, 0, 827, 10, 5], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "ALL = dict([(item.class_type, item) for item in globals().copy().values()\n if is_element(item)])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L134_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L148_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L148_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L153_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L158_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L160_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L172_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L174_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L176_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L181_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L181_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L186_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L195_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L195_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L202_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L204_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L204_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L209_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L209_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L219_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L223_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L225_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L227_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L233_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L237_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L239_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L241_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L243_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L245_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L257_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L257_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L265_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L271_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L276_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L276_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L289_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L291_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L297_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L297_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L303_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L305_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L313_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L319_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L325_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L327_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L336_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L334_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L352_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L356_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Expr_L357_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:FunctionDef_L356_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:If_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L360_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Assign_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1133:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1133:Return_L364_C4"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the element module."""
import base64
import unittest
import element
import util
class TestElement(unittest.TestCase):
"""Tests for the element.Element class."""
def testProperties(self):
el = element.Element(element.Gadget.class_type,
key='value')
self.assertEquals('value', el.key)
def testFormElement(self):
el = element.Input('input')
self.assertEquals(element.Input.class_type, el.type)
self.assertEquals(el.value, '')
self.assertEquals(el.name, 'input')
def testImage(self):
image = element.Image('http://test.com/image.png', width=100, height=100)
self.assertEquals(element.Image.class_type, image.type)
self.assertEquals(image.url, 'http://test.com/image.png')
self.assertEquals(image.width, 100)
self.assertEquals(image.height, 100)
def testAttachment(self):
attachment = element.Attachment(caption='My Favorite', data='SomefakeData')
self.assertEquals(element.Attachment.class_type, attachment.type)
self.assertEquals(attachment.caption, 'My Favorite')
self.assertEquals(attachment.data, 'SomefakeData')
def testGadget(self):
gadget = element.Gadget('http://test.com/gadget.xml')
self.assertEquals(element.Gadget.class_type, gadget.type)
self.assertEquals(gadget.url, 'http://test.com/gadget.xml')
def testInstaller(self):
installer = element.Installer('http://test.com/installer.xml')
self.assertEquals(element.Installer.class_type, installer.type)
self.assertEquals(installer.manifest, 'http://test.com/installer.xml')
def testSerialize(self):
image = element.Image('http://test.com/image.png', width=100, height=100)
s = util.serialize(image)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 3)
self.assertEquals(props['url'], 'http://test.com/image.png')
self.assertEquals(props['width'], 100)
self.assertEquals(props['height'], 100)
def testSerializeAttachment(self):
attachment = element.Attachment(caption='My Favorite', data='SomefakeData')
s = util.serialize(attachment)
k = s.keys()
k.sort()
# we should really have two things to serialize
props = s['properties']
self.assertEquals(len(props), 2)
self.assertEquals(props['caption'], 'My Favorite')
self.assertEquals(props['data'], base64.encodestring('SomefakeData'))
self.assertEquals(attachment.data, 'SomefakeData')
def testSerializeLine(self):
line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)
s = util.serialize(line)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 2)
self.assertEquals(props['alignment'], 'l')
self.assertEquals(props['lineType'], 'h1')
def testSerializeGadget(self):
gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None})
s = util.serialize(gadget)
k = s.keys()
k.sort()
# we should really only have three things to serialize
props = s['properties']
self.assertEquals(len(props), 3)
self.assertEquals(props['url'], 'http://test.com')
self.assertEquals(props['prop1'], 'a')
self.assertEquals(props['prop_cap'], None)
def testGadgetElementFromJson(self):
url = 'http://www.foo.com/gadget.xml'
json = {
'type': element.Gadget.class_type,
'properties': {
'url': url,
}
}
gadget = element.Element.from_json(json)
self.assertEquals(element.Gadget.class_type, gadget.type)
self.assertEquals(url, gadget.url)
def testImageElementFromJson(self):
url = 'http://www.foo.com/image.png'
width = '32'
height = '32'
attachment_id = '2'
caption = 'Test Image'
json = {
'type': element.Image.class_type,
'properties': {
'url': url,
'width': width,
'height': height,
'attachmentId': attachment_id,
'caption': caption,
}
}
image = element.Element.from_json(json)
self.assertEquals(element.Image.class_type, image.type)
self.assertEquals(url, image.url)
self.assertEquals(width, image.width)
self.assertEquals(height, image.height)
self.assertEquals(attachment_id, image.attachmentId)
self.assertEquals(caption, image.caption)
def testAttachmentElementFromJson(self):
caption = 'fake caption'
data = 'fake data'
mime_type = 'fake mime'
attachment_id = 'fake id'
attachment_url = 'fake URL'
json = {
'type': element.Attachment.class_type,
'properties': {
'caption': caption,
'data': data,
'mimeType': mime_type,
'attachmentId': attachment_id,
'attachmentUrl': attachment_url,
}
}
attachment = element.Element.from_json(json)
self.assertEquals(element.Attachment.class_type, attachment.type)
self.assertEquals(caption, attachment.caption)
self.assertEquals(data, attachment.data)
self.assertEquals(mime_type, attachment.mimeType)
self.assertEquals(attachment_id, attachment.attachmentId)
self.assertEquals(attachment_url, attachment.attachmentUrl)
def testFormElementFromJson(self):
name = 'button'
value = 'value'
default_value = 'foo'
json = {
'type': element.Label.class_type,
'properties': {
'name': name,
'value': value,
'defaultValue': default_value,
}
}
el = element.Element.from_json(json)
self.assertEquals(element.Label.class_type, el.type)
self.assertEquals(name, el.name)
self.assertEquals(value, el.value)
def testCanInstantiate(self):
bag = [element.Check(name='check', value='value'),
element.Button(name='button', value='caption'),
element.Input(name='input', value='caption'),
element.Label(label_for='button', caption='caption'),
element.RadioButton(name='name', group='group'),
element.RadioButtonGroup(name='name', value='value'),
element.Password(name='name', value='geheim'),
element.TextArea(name='name', value='\n\n\n'),
element.Installer(manifest='test.com/installer.xml'),
element.Line(line_type='type',
indent='3',
alignment='r',
direction='d'),
element.Gadget(url='test.com/gadget.xml',
props={'key1': 'val1', 'key2': 'val2'}),
element.Image(url='test.com/image.png', width=100, height=200),
element.Attachment(caption='fake caption', data='fake data')]
types_constructed = set([type(x) for x in bag])
types_required = set(element.ALL.values())
missing_required = types_constructed.difference(types_required)
self.assertEquals(missing_required, set())
missing_constructed = types_required.difference(types_constructed)
self.assertEquals(missing_constructed, set())
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1134 | 126 | 215 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0791, 0.0047, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the element module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Import_L20_C0", "label": "base64 import base64", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.093, 0.0047, 0, 0.66, 0.1667, 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_1134:Import_L21_C0", "label": "unittest import unittest", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0977, 0.0047, 0, 0.66, 0.3333, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.107, 0.0047, 0, 0.66, 0.5, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Import_L24_C0", "label": "util import util", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1116, 0.0047, 0, 0.66, 0.6667, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "label": "TestElement", "type": "class", "loc": [27, 211], "level": 0, "parent": null, "vector": [3, 0, 0.5535, 0.8605, 0, 0.66, 0.8333, 876, 0, 15, 0, 0, 878, 0, 99], "semantic": {"name": "TestElement", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestElement(unittest.TestCase):\n \"\"\"Tests for the element.Element class.\"\"\"\n\n def testProperties(self):\n el = element.Element(element.Gadget.class_type,\n key='value')\n self.assertEquals('value', el.key)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L28_C2", "label": "expression", "type": "expression", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [8, 1, 0.1302, 0.0047, 1, 0.33, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests for the element.Element class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2", "label": "testProperties", "type": "function", "loc": [30, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.1465, 0.0186, 1, 0.33, 0.0667, 59, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "testProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testProperties(self):\n el = element.Element(element.Gadget.class_type,\n key='value')\n self.assertEquals('value', el.key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L31_C4", "label": "el = Element()", "type": "assigned_variable", "loc": [31, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2", "vector": [14, 2, 0.1465, 0.0093, 2, 0.27, 0.0, 144, 3, 2, 0, 0, 873, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "Element", "annotation": ""}, "snippet": " el = element.Element(element.Gadget.class_type,\n key='value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L33_C4", "label": "assertEquals()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2", "vector": [8, 2, 0.1535, 0.0047, 2, 0.27, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('value', el.key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "label": "testFormElement", "type": "function", "loc": [35, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.1721, 0.0233, 1, 0.33, 0.1333, 695, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testFormElement", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFormElement(self):\n el = element.Input('input')\n self.assertEquals(element.Input.class_type, el.type)\n self.assertEquals(el.value, '')\n self.assertEquals(el.name, 'input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L36_C4", "label": "el = Input()", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "vector": [14, 2, 0.1674, 0.0047, 2, 0.54, 0.0, 144, 3, 1, 0, 0, 35, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "Input", "annotation": ""}, "snippet": " el = element.Input('input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L37_C4", "label": "assertEquals()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "vector": [8, 2, 0.1721, 0.0047, 2, 0.54, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Input.class_type, el.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L38_C4", "label": "assertEquals()", "type": "expression", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "vector": [8, 2, 0.1767, 0.0047, 2, 0.54, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(el.value, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L39_C4", "label": "assertEquals()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "vector": [8, 2, 0.1814, 0.0047, 2, 0.54, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(el.name, 'input')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "label": "testImage", "type": "function", "loc": [41, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.2023, 0.0279, 1, 0.33, 0.2, 172, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testImage", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testImage(self):\n image = element.Image('http://test.com/image.png', width=100, height=100)\n self.assertEquals(element.Image.class_type, image.type)\n self.assertEquals(image.url, 'http://test.com/image.png')\n self.assertEquals(image.width, 100)\n self.assertEquals(image.height, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L42_C4", "label": "image = Image()", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "vector": [14, 2, 0.1953, 0.0047, 2, 0.62, 0.0, 505, 3, 3, 0, 0, 721, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "Image", "annotation": ""}, "snippet": " image = element.Image('http://test.com/image.png', width=100, height=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L43_C4", "label": "assertEquals()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "vector": [8, 2, 0.2, 0.0047, 2, 0.62, 0.25, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Image.class_type, image.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L44_C4", "label": "assertEquals()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "vector": [8, 2, 0.2047, 0.0047, 2, 0.62, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.url, 'http://test.com/image.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L45_C4", "label": "assertEquals()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "vector": [8, 2, 0.2093, 0.0047, 2, 0.62, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.width, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L46_C4", "label": "assertEquals()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "vector": [8, 2, 0.214, 0.0047, 2, 0.62, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(image.height, 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "label": "testAttachment", "type": "function", "loc": [48, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.2326, 0.0233, 1, 0.33, 0.2667, 181, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testAttachment", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAttachment(self):\n attachment = element.Attachment(caption='My Favorite', data='SomefakeData')\n self.assertEquals(element.Attachment.class_type, attachment.type)\n self.assertEquals(attachment.caption, 'My Favorite')\n self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L49_C4", "label": "attachment = Attachment()", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "vector": [14, 2, 0.2279, 0.0047, 2, 0.2, 0.0, 113, 3, 2, 0, 0, 312, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "Attachment", "annotation": ""}, "snippet": " attachment = element.Attachment(caption='My Favorite', data='SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L50_C4", "label": "assertEquals()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "vector": [8, 2, 0.2326, 0.0047, 2, 0.2, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Attachment.class_type, attachment.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L51_C4", "label": "assertEquals()", "type": "expression", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "vector": [8, 2, 0.2372, 0.0047, 2, 0.2, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.caption, 'My Favorite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L52_C4", "label": "assertEquals()", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "vector": [8, 2, 0.2419, 0.0047, 2, 0.2, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "label": "testGadget", "type": "function", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.2581, 0.0186, 1, 0.33, 0.3333, 832, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testGadget", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testGadget(self):\n gadget = element.Gadget('http://test.com/gadget.xml')\n self.assertEquals(element.Gadget.class_type, gadget.type)\n self.assertEquals(gadget.url, 'http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L55_C4", "label": "gadget = Gadget()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "vector": [14, 2, 0.2558, 0.0047, 2, 0.25, 0.0, 109, 3, 1, 0, 0, 136, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "Gadget", "annotation": ""}, "snippet": " gadget = element.Gadget('http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L56_C4", "label": "assertEquals()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "vector": [8, 2, 0.2605, 0.0047, 2, 0.25, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, gadget.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L57_C4", "label": "assertEquals()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "vector": [8, 2, 0.2651, 0.0047, 2, 0.25, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(gadget.url, 'http://test.com/gadget.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "label": "testInstaller", "type": "function", "loc": [59, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.2814, 0.0186, 1, 0.33, 0.4, 185, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testInstaller", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInstaller(self):\n installer = element.Installer('http://test.com/installer.xml')\n self.assertEquals(element.Installer.class_type, installer.type)\n self.assertEquals(installer.manifest, 'http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L60_C4", "label": "installer = Installer()", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "vector": [14, 2, 0.2791, 0.0047, 2, 0.14, 0.0, 244, 3, 1, 0, 0, 426, 10, 1], "semantic": {"name": "installer", "arg_names": [], "import_names": [], "rhs_call_name": "Installer", "annotation": ""}, "snippet": " installer = element.Installer('http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L61_C4", "label": "assertEquals()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "vector": [8, 2, 0.2837, 0.0047, 2, 0.14, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Installer.class_type, installer.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L62_C4", "label": "assertEquals()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "vector": [8, 2, 0.2884, 0.0047, 2, 0.14, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(installer.manifest, 'http://test.com/installer.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "label": "testSerialize", "type": "function", "loc": [64, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.3209, 0.0512, 1, 0.33, 0.4667, 465, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n image = element.Image('http://test.com/image.png', width=100, height=100)\n s = util.serialize(image)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L65_C4", "label": "image = Image()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [14, 2, 0.3023, 0.0047, 2, 0.86, 0.0, 505, 3, 3, 0, 0, 721, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "Image", "annotation": ""}, "snippet": " image = element.Image('http://test.com/image.png', width=100, height=100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L66_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [14, 2, 0.307, 0.0047, 2, 0.86, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(image)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L67_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [14, 2, 0.3116, 0.0047, 2, 0.86, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L68_C4", "label": "sort()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [8, 2, 0.3163, 0.0047, 2, 0.86, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L70_C4", "label": "props =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [14, 2, 0.3256, 0.0047, 2, 0.86, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [8, 2, 0.3302, 0.0047, 2, 0.86, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [8, 2, 0.3349, 0.0047, 2, 0.86, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['url'], 'http://test.com/image.png')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [8, 2, 0.3395, 0.0047, 2, 0.86, 0.875, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['width'], 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "vector": [8, 2, 0.3442, 0.0047, 2, 0.86, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['height'], 100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "label": "testSerializeAttachment", "type": "function", "loc": [76, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.3767, 0.0512, 1, 0.33, 0.5333, 631, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testSerializeAttachment", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeAttachment(self):\n attachment = element.Attachment(caption='My Favorite', data='SomefakeData')\n s = util.serialize(attachment)\n k = s.keys()\n k.sort()\n # we should really have two things to serialize\n props = s['properties']\n self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L77_C4", "label": "attachment = Attachment()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [14, 2, 0.3581, 0.0047, 2, 0.68, 0.0, 113, 3, 2, 0, 0, 312, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "Attachment", "annotation": ""}, "snippet": " attachment = element.Attachment(caption='My Favorite', data='SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L78_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [14, 2, 0.3628, 0.0047, 2, 0.68, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(attachment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L79_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [14, 2, 0.3674, 0.0047, 2, 0.68, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L80_C4", "label": "sort()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [8, 2, 0.3721, 0.0047, 2, 0.68, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L82_C4", "label": "props =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [14, 2, 0.3814, 0.0047, 2, 0.68, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [8, 2, 0.386, 0.0047, 2, 0.68, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L84_C4", "label": "assertEquals()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [8, 2, 0.3907, 0.0047, 2, 0.68, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['caption'], 'My Favorite')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L85_C4", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [8, 2, 0.3953, 0.0047, 2, 0.68, 0.875, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['data'], base64.encodestring('SomefakeData'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "vector": [8, 2, 0.4, 0.0047, 2, 0.68, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment.data, 'SomefakeData')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "label": "testSerializeLine", "type": "function", "loc": [88, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.4302, 0.0465, 1, 0.33, 0.6, 355, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testSerializeLine", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeLine(self):\n line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)\n s = util.serialize(line)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L89_C4", "label": "line = Line()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [14, 2, 0.414, 0.0047, 2, 0.22, 0.0, 373, 3, 2, 0, 0, 650, 10, 1], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "Line", "annotation": ""}, "snippet": " line = element.Line(element.Line.TYPE_H1, alignment=element.Line.ALIGN_LEFT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L90_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [14, 2, 0.4186, 0.0047, 2, 0.22, 0.1429, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L91_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [14, 2, 0.4233, 0.0047, 2, 0.22, 0.2857, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L92_C4", "label": "sort()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [8, 2, 0.4279, 0.0047, 2, 0.22, 0.4286, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L94_C4", "label": "props =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [14, 2, 0.4372, 0.0047, 2, 0.22, 0.5714, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [8, 2, 0.4419, 0.0047, 2, 0.22, 0.7143, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L96_C4", "label": "assertEquals()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [8, 2, 0.4465, 0.0047, 2, 0.22, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['alignment'], 'l')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L97_C4", "label": "assertEquals()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "vector": [8, 2, 0.4512, 0.0047, 2, 0.22, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['lineType'], 'h1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "label": "testSerializeGadget", "type": "function", "loc": [99, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.4837, 0.0512, 1, 0.33, 0.6667, 505, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSerializeGadget", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerializeGadget(self):\n gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None}) \n s = util.serialize(gadget)\n k = s.keys()\n k.sort()\n # we should really only have three things to serialize\n props = s['properties']\n self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L100_C4", "label": "gadget = Gadget()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [14, 2, 0.4651, 0.0047, 2, 0.85, 0.0, 109, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "Gadget", "annotation": ""}, "snippet": " gadget = element.Gadget('http://test.com', {'prop1': 'a', 'prop_cap': None}) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L101_C4", "label": "s = serialize()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [14, 2, 0.4698, 0.0047, 2, 0.85, 0.125, 553, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " s = util.serialize(gadget)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L102_C4", "label": "k = keys()", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [14, 2, 0.4744, 0.0047, 2, 0.85, 0.25, 954, 3, 0, 0, 0, 204, 10, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "keys", "annotation": ""}, "snippet": " k = s.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L103_C4", "label": "sort()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [8, 2, 0.4791, 0.0047, 2, 0.85, 0.375, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " k.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L105_C4", "label": "props =", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [14, 2, 0.4884, 0.0047, 2, 0.85, 0.5, 675, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = s['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [8, 2, 0.493, 0.0047, 2, 0.85, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(props), 3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [8, 2, 0.4977, 0.0047, 2, 0.85, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['url'], 'http://test.com')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [8, 2, 0.5023, 0.0047, 2, 0.85, 0.875, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['prop1'], 'a')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L109_C4", "label": "assertEquals()", "type": "expression", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "vector": [8, 2, 0.507, 0.0047, 2, 0.85, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(props['prop_cap'], None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "label": "testGadgetElementFromJson", "type": "function", "loc": [111, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.5395, 0.0512, 1, 0.33, 0.7333, 203, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "testGadgetElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testGadgetElementFromJson(self):\n url = 'http://www.foo.com/gadget.xml'\n json = {\n 'type': element.Gadget.class_type,\n 'properties': {\n 'url': url,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L112_C4", "label": "url =", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "vector": [14, 2, 0.5209, 0.0047, 2, 0.08, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.foo.com/gadget.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L113_C4", "label": "json =", "type": "assigned_variable", "loc": [113, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "vector": [14, 2, 0.5372, 0.0279, 2, 0.08, 0.25, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Gadget.class_type,\n 'properties': {\n 'url': url,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L119_C4", "label": "gadget = from_json()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "vector": [14, 2, 0.5535, 0.0047, 2, 0.08, 0.5, 109, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "gadget", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " gadget = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L120_C4", "label": "assertEquals()", "type": "expression", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "vector": [8, 2, 0.5581, 0.0047, 2, 0.08, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, gadget.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L121_C4", "label": "assertEquals()", "type": "expression", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "vector": [8, 2, 0.5628, 0.0047, 2, 0.08, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(url, gadget.url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "label": "testImageElementFromJson", "type": "function", "loc": [123, 145], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.6233, 0.107, 1, 0.33, 0.8, 640, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testImageElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testImageElementFromJson(self):\n url = 'http://www.foo.com/image.png'\n width = '32'\n height = '32'\n attachment_id = '2'\n caption = 'Test Image'\n json = {\n 'type': element.Image.class_type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L124_C4", "label": "url =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.5767, 0.0047, 2, 0.54, 0.0, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.foo.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L125_C4", "label": "width =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.5814, 0.0047, 2, 0.54, 0.0833, 989, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "width", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " width = '32'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L126_C4", "label": "height =", "type": "assigned_variable", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.586, 0.0047, 2, 0.54, 0.1667, 751, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "height", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " height = '32'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L127_C4", "label": "attachment_id =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.5907, 0.0047, 2, 0.54, 0.25, 475, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_id = '2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L128_C4", "label": "caption =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.5953, 0.0047, 2, 0.54, 0.3333, 512, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "caption", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caption = 'Test Image'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L129_C4", "label": "json =", "type": "assigned_variable", "loc": [129, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.6209, 0.0465, 2, 0.54, 0.4167, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Image.class_type,\n 'properties': {\n 'url': url,\n 'width': width,\n 'height': height,\n 'attachmentId': attachment_id,\n 'caption': caption,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L139_C4", "label": "image = from_json()", "type": "assigned_variable", "loc": [139, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [14, 2, 0.6465, 0.0047, 2, 0.54, 0.5, 505, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "image", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " image = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L140_C4", "label": "assertEquals()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6512, 0.0047, 2, 0.54, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Image.class_type, image.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6558, 0.0047, 2, 0.54, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(url, image.url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L142_C4", "label": "assertEquals()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6605, 0.0047, 2, 0.54, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(width, image.width)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L143_C4", "label": "assertEquals()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6651, 0.0047, 2, 0.54, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(height, image.height)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L144_C4", "label": "assertEquals()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6698, 0.0047, 2, 0.54, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_id, image.attachmentId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "vector": [8, 2, 0.6744, 0.0047, 2, 0.54, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(caption, image.caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "label": "testAttachmentElementFromJson", "type": "function", "loc": [147, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.7349, 0.107, 1, 0.33, 0.8667, 740, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testAttachmentElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAttachmentElementFromJson(self):\n caption = 'fake caption'\n data = 'fake data'\n mime_type = 'fake mime'\n attachment_id = 'fake id'\n attachment_url = 'fake URL'\n json = {\n 'type': element.Attachment.class_type,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L148_C4", "label": "caption =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.6884, 0.0047, 2, 0.98, 0.0, 512, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "caption", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " caption = 'fake caption'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L149_C4", "label": "data =", "type": "assigned_variable", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.693, 0.0047, 2, 0.98, 0.0833, 929, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = 'fake data'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L150_C4", "label": "mime_type =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.6977, 0.0047, 2, 0.98, 0.1667, 188, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "mime_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mime_type = 'fake mime'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L151_C4", "label": "attachment_id =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.7023, 0.0047, 2, 0.98, 0.25, 475, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_id = 'fake id'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L152_C4", "label": "attachment_url =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.707, 0.0047, 2, 0.98, 0.3333, 32, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "attachment_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " attachment_url = 'fake URL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L153_C4", "label": "json =", "type": "assigned_variable", "loc": [153, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.7326, 0.0465, 2, 0.98, 0.4167, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Attachment.class_type,\n 'properties': {\n 'caption': caption,\n 'data': data,\n 'mimeType': mime_type,\n 'attachmentId': attachment_id,\n 'attachmentUrl': attachment_url,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L163_C4", "label": "attachment = from_json()", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [14, 2, 0.7581, 0.0047, 2, 0.98, 0.5, 113, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "attachment", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " attachment = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L164_C4", "label": "assertEquals()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.7628, 0.0047, 2, 0.98, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Attachment.class_type, attachment.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L165_C4", "label": "assertEquals()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.7674, 0.0047, 2, 0.98, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(caption, attachment.caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L166_C4", "label": "assertEquals()", "type": "expression", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.7721, 0.0047, 2, 0.98, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(data, attachment.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L167_C4", "label": "assertEquals()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.7767, 0.0047, 2, 0.98, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(mime_type, attachment.mimeType)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L168_C4", "label": "assertEquals()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.7814, 0.0047, 2, 0.98, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_id, attachment.attachmentId)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L169_C4", "label": "assertEquals()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "vector": [8, 2, 0.786, 0.0047, 2, 0.98, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(attachment_url, attachment.attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "label": "testFormElementFromJson", "type": "function", "loc": [171, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.8302, 0.0744, 1, 0.33, 0.9333, 918, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testFormElementFromJson", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFormElementFromJson(self):\n name = 'button'\n value = 'value'\n default_value = 'foo'\n json = {\n 'type': element.Label.class_type,\n 'properties': {\n 'name': name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L172_C4", "label": "name =", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [14, 2, 0.8, 0.0047, 2, 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 = 'button'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L173_C4", "label": "value =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [14, 2, 0.8047, 0.0047, 2, 0.0, 0.1429, 441, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " value = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L174_C4", "label": "default_value =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [14, 2, 0.8093, 0.0047, 2, 0.0, 0.2857, 876, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "default_value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " default_value = 'foo'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L175_C4", "label": "json =", "type": "assigned_variable", "loc": [175, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [14, 2, 0.8302, 0.0372, 2, 0.0, 0.4286, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = {\n 'type': element.Label.class_type,\n 'properties': {\n 'name': name,\n 'value': value,\n 'defaultValue': default_value,\n }\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L183_C4", "label": "el = from_json()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [14, 2, 0.8512, 0.0047, 2, 0.0, 0.5714, 144, 3, 1, 0, 0, 975, 10, 1], "semantic": {"name": "el", "arg_names": [], "import_names": [], "rhs_call_name": "from_json", "annotation": ""}, "snippet": " el = element.Element.from_json(json)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L184_C4", "label": "assertEquals()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [8, 2, 0.8558, 0.0047, 2, 0.0, 0.7143, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Label.class_type, el.type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L185_C4", "label": "assertEquals()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [8, 2, 0.8605, 0.0047, 2, 0.0, 0.8571, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(name, el.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L186_C4", "label": "assertEquals()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "vector": [8, 2, 0.8651, 0.0047, 2, 0.0, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(value, el.value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "label": "testCanInstantiate", "type": "function", "loc": [188, 211], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "vector": [2, 1, 0.9279, 0.1116, 1, 0.33, 1.0, 394, 0, 1, 0, 0, 0, 0, 23], "semantic": {"name": "testCanInstantiate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testCanInstantiate(self):\n bag = [element.Check(name='check', value='value'),\n element.Button(name='button', value='caption'),\n element.Input(name='input', value='caption'),\n element.Label(label_for='button', caption='caption'),\n element.RadioButton(name='name', group='group'),\n element.RadioButtonGroup(name='name', value='value'),\n element.Password(name='name', value='geheim'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L189_C4", "label": "bag =", "type": "assigned_variable", "loc": [189, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [14, 2, 0.9163, 0.0791, 2, 0.35, 0.0, 117, 0, 0, 0, 0, 0, 5, 13], "semantic": {"name": "bag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bag = [element.Check(name='check', value='value'),\n element.Button(name='button', value='caption'),\n element.Input(name='input', value='caption'),\n element.Label(label_for='button', caption='caption'),\n element.RadioButton(name='name', group='group'),\n element.RadioButtonGroup(name='name', value='value'),\n element.Password(name='name', value='geheim'),\n element.TextArea(name='name', value='\\n\\n\\n'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L206_C4", "label": "types_constructed = set()", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [14, 2, 0.9581, 0.0047, 2, 0.35, 0.1667, 491, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "types_constructed", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " types_constructed = set([type(x) for x in bag])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L207_C4", "label": "types_required = set()", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [14, 2, 0.9628, 0.0047, 2, 0.35, 0.3333, 312, 3, 1, 0, 0, 21, 10, 2], "semantic": {"name": "types_required", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " types_required = set(element.ALL.values())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L208_C4", "label": "missing_required = difference()", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [14, 2, 0.9674, 0.0047, 2, 0.35, 0.5, 995, 3, 1, 0, 0, 498, 10, 1], "semantic": {"name": "missing_required", "arg_names": [], "import_names": [], "rhs_call_name": "difference", "annotation": ""}, "snippet": " missing_required = types_constructed.difference(types_required)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L209_C4", "label": "assertEquals()", "type": "expression", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [8, 2, 0.9721, 0.0047, 2, 0.35, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(missing_required, set())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L210_C4", "label": "missing_constructed = difference()", "type": "assigned_variable", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [14, 2, 0.9767, 0.0047, 2, 0.35, 0.8333, 70, 3, 1, 0, 0, 498, 10, 1], "semantic": {"name": "missing_constructed", "arg_names": [], "import_names": [], "rhs_call_name": "difference", "annotation": ""}, "snippet": " missing_constructed = types_required.difference(types_constructed)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L211_C4", "label": "assertEquals()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "vector": [8, 2, 0.9814, 0.0047, 2, 0.35, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(missing_constructed, set())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:If_L214_C0", "label": "if", "type": "if", "loc": [214, 215], "level": 0, "parent": null, "vector": [4, 0, 0.9977, 0.0093, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L215_C2", "label": "main()", "type": "expression", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1134:If_L214_C0", "vector": [8, 1, 1.0, 0.0047, 1, 0.87, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L35_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:FunctionDef_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1134:If_L214_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1134:Expr_L215_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Defines classes that are needed to model a wavelet."""
import blip
import errors
import util
class DataDocs(object):
"""Class modeling a bunch of data documents in pythonic way."""
def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):
self._docs = init_docs
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __iter__(self):
return self._docs.__iter__()
def __contains__(self, key):
return key in self._docs
def __delitem__(self, key):
if not key in self._docs:
return
self._operation_queue.wavelet_datadoc_set(
self._wave_id, self._wavelet_id, key, None)
del self._docs[key]
def __getitem__(self, key):
return self._docs[key]
def __setitem__(self, key, value):
self._operation_queue.wavelet_datadoc_set(
self._wave_id, self._wavelet_id, key, value)
if value is None and key in self._docs:
del self._docs[key]
else:
self._docs[key] = value
def __len__(self):
return len(self._docs)
def keys(self):
return self._docs.keys()
def serialize(self):
"""Returns a dictionary of the data documents."""
return self._docs
class Participants(object):
"""Class modelling a set of participants in pythonic way."""
#: Designates full access (read/write) role.
ROLE_FULL = "FULL"
#: Designates read-only role.
ROLE_READ_ONLY = "READ_ONLY"
def __init__(self, participants, roles, wave_id, wavelet_id, operation_queue):
self._participants = set(participants)
self._roles = roles.copy()
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __contains__(self, participant):
return participant in self._participants
def __len__(self):
return len(self._participants)
def __iter__(self):
return self._participants.__iter__()
def add(self, participant_id):
"""Adds a participant by their ID (address)."""
self._operation_queue.wavelet_add_participant(
self._wave_id, self._wavelet_id, participant_id)
self._participants.add(participant_id)
def get_role(self, participant_id):
"""Return the role for the given participant_id."""
return self._roles.get(participant_id, Participants.ROLE_FULL)
def set_role(self, participant_id, role):
"""Sets the role for the given participant_id."""
if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:
raise ValueError(role + ' is not a valid role')
self._operation_queue.wavelet_modify_participant_role(
self._wave_id, self._wavelet_id, participant_id, role)
self._roles[participant_id] = role
def serialize(self):
"""Returns a list of the participants."""
return list(self._participants)
class Tags(object):
"""Class modelling a list of tags."""
def __init__(self, tags, wave_id, wavelet_id, operation_queue):
self._tags = list(tags)
self._wave_id = wave_id
self._wavelet_id = wavelet_id
self._operation_queue = operation_queue
def __getitem__(self, index):
return self._tags[index]
def __len__(self):
return len(self._tags)
def __iter__(self):
return self._tags.__iter__()
def append(self, tag):
"""Appends a tag if it doesn't already exist."""
tag = util.force_unicode(tag)
if tag in self._tags:
return
self._operation_queue.wavelet_modify_tag(
self._wave_id, self._wavelet_id, tag)
self._tags.append(tag)
def remove(self, tag):
"""Removes a tag if it exists."""
tag = util.force_unicode(tag)
if not tag in self._tags:
return
self._operation_queue.wavelet_modify_tag(
self._wave_id, self._wavelet_id, tag, modify_how='remove')
self._tags.remove(tag)
def serialize(self):
"""Returns a list of tags."""
return list(self._tags)
class Wavelet(object):
"""Models a single wavelet.
A single wavelet is composed of metadata, participants, and its blips.
To guarantee that all blips are available, specify Context.ALL for events.
"""
def __init__(self, json, blips, robot, operation_queue):
"""Inits this wavelet with JSON data.
Args:
json: JSON data dictionary from Wave server.
blips: a dictionary object that can be used to resolve blips.
robot: the robot owning this wavelet.
operation_queue: an OperationQueue object to be used to
send any generated operations to.
"""
self._robot = robot
self._operation_queue = operation_queue
self._wave_id = json.get('waveId')
self._wavelet_id = json.get('waveletId')
self._creator = json.get('creator')
self._creation_time = json.get('creationTime', 0)
self._data_documents = DataDocs(json.get('dataDocuments', {}),
self._wave_id,
self._wavelet_id,
operation_queue)
self._last_modified_time = json.get('lastModifiedTime')
self._participants = Participants(json.get('participants', []),
json.get('participantRoles', {}),
self._wave_id,
self._wavelet_id,
operation_queue)
self._title = json.get('title', '')
self._tags = Tags(json.get('tags', []),
self._wave_id,
self._wavelet_id,
operation_queue)
self._raw_data = json
self._blips = blip.Blips(blips)
self._root_blip_id = json.get('rootBlipId')
if self._root_blip_id and self._root_blip_id in self._blips:
self._root_blip = self._blips[self._root_blip_id]
else:
self._root_blip = None
self._robot_address = None
@property
def wavelet_id(self):
"""Returns this wavelet's id."""
return self._wavelet_id
@property
def wave_id(self):
"""Returns this wavelet's parent wave id."""
return self._wave_id
@property
def creator(self):
"""Returns the participant id of the creator of this wavelet."""
return self._creator
@property
def creation_time(self):
"""Returns the time that this wavelet was first created in milliseconds."""
return self._creation_time
@property
def data_documents(self):
"""Returns the data documents for this wavelet based on key name."""
return self._data_documents
@property
def domain(self):
"""Return the domain that wavelet belongs to."""
p = self._wave_id.find('!')
if p == -1:
return None
else:
return self._wave_id[:p]
@property
def last_modified_time(self):
"""Returns the time that this wavelet was last modified in ms."""
return self._last_modified_time
@property
def participants(self):
"""Returns a set of participants on this wavelet."""
return self._participants
@property
def tags(self):
"""Returns a list of tags for this wavelet."""
return self._tags
@property
def robot(self):
"""The robot that owns this wavelet."""
return self._robot
def _get_title(self):
return self._title
def _set_title(self, title):
title = util.force_unicode(title)
if title.find('\n') != -1:
raise errors.Error('Wavelet title should not contain a newline ' +
'character. Specified: ' + title)
self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,
title)
self._title = title
# Adjust the content of the root blip, if it is available in the context.
if self._root_blip:
content = '\n'
splits = self._root_blip._content.split('\n', 2)
if len(splits) == 3:
content += splits[2]
self._root_blip._content = '\n' + title + content
#: Returns or sets the wavelet's title.
title = property(_get_title, _set_title,
doc='Get or set the title of the wavelet.')
def _get_robot_address(self):
return self._robot_address
def _set_robot_address(self, address):
if self._robot_address:
raise errors.Error('robot address already set')
self._robot_address = address
robot_address = property(_get_robot_address, _set_robot_address,
doc='Get or set the address of the current robot.')
@property
def root_blip(self):
"""Returns this wavelet's root blip."""
return self._root_blip
@property
def blips(self):
"""Returns the blips for this wavelet."""
return self._blips
def get_operation_queue(self):
"""Returns the OperationQueue for this wavelet."""
return self._operation_queue
def serialize(self):
"""Return a dict of the wavelet properties."""
return {'waveId': self._wave_id,
'waveletId': self._wavelet_id,
'creator': self._creator,
'creationTime': self._creation_time,
'dataDocuments': self._data_documents.serialize(),
'lastModifiedTime': self._last_modified_time,
'participants': self._participants.serialize(),
'title': self._title,
'blips': self._blips.serialize(),
'rootBlipId': self._root_blip_id
}
def proxy_for(self, proxy_for_id):
"""Return a view on this wavelet that will proxy for the specified id.
A shallow copy of the current wavelet is returned with the proxy_for_id
set. Any modifications made to this copy will be done using the
proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will
be used.
If the wavelet was retrieved using the Active Robot API, that is
by fetch_wavelet, then the address of the robot must be added to the
wavelet by setting wavelet.robot_address before calling proxy_for().
"""
self.add_proxying_participant(proxy_for_id)
operation_queue = self.get_operation_queue().proxy_for(proxy_for_id)
res = Wavelet(json={},
blips={},
robot=self.robot,
operation_queue=operation_queue)
res._wave_id = self._wave_id
res._wavelet_id = self._wavelet_id
res._creator = self._creator
res._creation_time = self._creation_time
res._data_documents = self._data_documents
res._last_modified_time = self._last_modified_time
res._participants = self._participants
res._title = self._title
res._raw_data = self._raw_data
res._blips = self._blips
res._root_blip = self._root_blip
return res
def add_proxying_participant(self, id):
"""Ads a proxying participant to the wave.
Proxying participants are of the form robot+proxy@domain.com. This
convenience method constructs this id and then calls participants.add.
"""
if not self.robot_address:
raise errors.Error(
'Need a robot address to add a proxying for participant')
robotid, domain = self.robot_address.split('@', 1)
if '#' in robotid:
robotid, version = robotid.split('#')
else:
version = None
if '+' in robotid:
newid = robotid.split('+', 1)[0] + '+' + id
else:
newid = robotid + '+' + id
if version:
newid += '#' + version
newid += '@' + domain
self.participants.add(newid)
def submit_with(self, other_wavelet):
"""Submit this wavelet when the passed other wavelet is submited.
wavelets constructed outside of the event callback need to
be either explicitly submited using robot.submit(wavelet) or be
associated with a different wavelet that will be submited or
is part of the event callback.
"""
other_wavelet._operation_queue.copy_operations(self._operation_queue)
self._operation_queue = other_wavelet._operation_queue
def reply(self, initial_content=None):
"""Replies to the conversation in this wavelet.
Args:
initial_content: If set, start with this (string) content.
Returns:
A transient version of the blip that contains the reply.
"""
if not initial_content:
initial_content = u'\n'
initial_content = util.force_unicode(initial_content)
blip_data = self._operation_queue.wavelet_append_blip(
self.wave_id, self.wavelet_id, initial_content)
instance = blip.Blip(blip_data, self._blips, self._operation_queue)
self._blips._add(instance)
return instance
def delete(self, todelete):
"""Remove a blip from this wavelet.
Args:
todelete: either a blip or a blip id to be removed.
"""
if isinstance(todelete, blip.Blip):
blip_id = todelete.blip_id
else:
blip_id = todelete
self._operation_queue.blip_delete(self.wave_id, self.wavelet_id, blip_id)
self._blips._remove_with_id(blip_id)
| ajibawa-2023/Python-Code-Large/train/row_1135 | 228 | 418 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0407, 0.0024, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Defines classes that are needed to model a wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Import_L19_C0", "label": "blip import blip", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0455, 0.0024, 0, 0.66, 0.1429, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Import_L20_C0", "label": "errors import errors", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0478, 0.0024, 0, 0.66, 0.2857, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Import_L21_C0", "label": "util import util", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0502, 0.0024, 0, 0.66, 0.4286, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "label": "DataDocs", "type": "class", "loc": [24, 65], "level": 0, "parent": null, "vector": [3, 0, 0.1065, 0.1005, 0, 0.66, 0.5714, 119, 0, 9, 0, 0, 186, 0, 5], "semantic": {"name": "DataDocs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DataDocs(object):\n \"\"\"Class modeling a bunch of data documents in pythonic way.\"\"\"\n\n def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):\n self._docs = init_docs\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [8, 1, 0.0598, 0.0024, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modeling a bunch of data documents in pythonic way.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "label": "__init__", "type": "function", "loc": [27, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.0694, 0.012, 1, 0.19, 0.1111, 555, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "init_docs", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, init_docs, wave_id, wavelet_id, operation_queue):\n self._docs = init_docs\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L28_C4", "label": "self._docs =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "vector": [14, 2, 0.067, 0.0024, 2, 0.16, 0.0, 879, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._docs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._docs = init_docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L29_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "vector": [14, 2, 0.0694, 0.0024, 2, 0.16, 0.3333, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L30_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [30, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "vector": [14, 2, 0.0718, 0.0024, 2, 0.16, 0.6667, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L31_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "vector": [14, 2, 0.0742, 0.0024, 2, 0.16, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L33_C2", "label": "__iter__", "type": "function", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.0801, 0.0048, 1, 0.19, 0.2222, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._docs.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L33_C2", "vector": [13, 2, 0.0813, 0.0024, 2, 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._docs.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L36_C2", "label": "__contains__", "type": "function", "loc": [36, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.0873, 0.0048, 1, 0.19, 0.3333, 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._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L37_C4", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L36_C2", "vector": [13, 2, 0.0885, 0.0024, 2, 0.4, 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._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2", "label": "__delitem__", "type": "function", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.0993, 0.0144, 1, 0.19, 0.4444, 66, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__delitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, key):\n if not key in self._docs:\n return\n self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, None)\n del self._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L40_C4", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2", "vector": [4, 2, 0.0969, 0.0048, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not key in self._docs:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L41_C6", "label": "return", "type": "return", "loc": [41, 41], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L40_C4", "vector": [13, 3, 0.0981, 0.0024, 3, 0.01, 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_1135:Expr_L42_C4", "label": "wavelet_datadoc_set()", "type": "expression", "loc": [42, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2", "vector": [8, 2, 0.1017, 0.0048, 2, 0.93, 1.0, 590, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_datadoc_set", "annotation": ""}, "snippet": " self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L46_C2", "label": "__getitem__", "type": "function", "loc": [46, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.1112, 0.0048, 1, 0.19, 0.5556, 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._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L46_C2", "vector": [13, 2, 0.1124, 0.0024, 2, 0.07, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._docs[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2", "label": "__setitem__", "type": "function", "loc": [49, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.1244, 0.0167, 1, 0.19, 0.6667, 343, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, key, value):\n self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, value)\n if value is None and key in self._docs:\n del self._docs[key]\n else:\n self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L50_C4", "label": "wavelet_datadoc_set()", "type": "expression", "loc": [50, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2", "vector": [8, 2, 0.1208, 0.0048, 2, 0.09, 0.0, 590, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_datadoc_set", "annotation": ""}, "snippet": " self._operation_queue.wavelet_datadoc_set(\n self._wave_id, self._wavelet_id, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L52_C4", "label": "if", "type": "if", "loc": [52, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2", "vector": [4, 2, 0.128, 0.0096, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value is None and key in self._docs:\n del self._docs[key]\n else:\n self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L55_C6", "label": "assign", "type": "assigned_variable", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L52_C4", "vector": [14, 3, 0.1316, 0.0024, 3, 0.73, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._docs[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L57_C2", "label": "__len__", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.1376, 0.0048, 1, 0.19, 0.7778, 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 return len(self._docs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L57_C2", "vector": [13, 2, 0.1388, 0.0024, 2, 0.04, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._docs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L60_C2", "label": "keys", "type": "function", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.1447, 0.0048, 1, 0.19, 0.8889, 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._docs.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L60_C2", "vector": [13, 2, 0.1459, 0.0024, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._docs.keys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2", "label": "serialize", "type": "function", "loc": [63, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "vector": [2, 1, 0.1531, 0.0072, 1, 0.19, 1.0, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a dictionary of the data documents.\"\"\"\n return self._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L64_C4", "label": "expression", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2", "vector": [8, 2, 0.1531, 0.0024, 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 a dictionary of the data documents.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2", "vector": [13, 2, 0.1555, 0.0024, 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._docs"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "label": "Participants", "type": "class", "loc": [68, 113], "level": 0, "parent": null, "vector": [3, 0, 0.2165, 0.11, 0, 0.66, 0.7143, 0, 0, 8, 0, 0, 186, 0, 10], "semantic": {"name": "Participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Participants(object):\n \"\"\"Class modelling a set of participants in pythonic way.\"\"\"\n\n #: Designates full access (read/write) role.\n ROLE_FULL = \"FULL\"\n\n #: Designates read-only role.\n ROLE_READ_ONLY = \"READ_ONLY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L69_C2", "label": "expression", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [8, 1, 0.1651, 0.0024, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modelling a set of participants in pythonic way.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L72_C2", "label": "ROLE_FULL =", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [14, 1, 0.1722, 0.0024, 1, 0.69, 0.1, 221, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROLE_FULL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROLE_FULL = \"FULL\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L75_C2", "label": "ROLE_READ_ONLY =", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [14, 1, 0.1794, 0.0024, 1, 0.69, 0.2, 638, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROLE_READ_ONLY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROLE_READ_ONLY = \"READ_ONLY\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "label": "__init__", "type": "function", "loc": [77, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.1902, 0.0144, 1, 0.69, 0.3, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "participants", "roles", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, participants, roles, wave_id, wavelet_id, operation_queue):\n self._participants = set(participants)\n self._roles = roles.copy()\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L78_C4", "label": "self._participants = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "vector": [14, 2, 0.1866, 0.0024, 2, 0.68, 0.0, 462, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "self._participants", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " self._participants = set(participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L79_C4", "label": "self._roles = copy()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "vector": [14, 2, 0.189, 0.0024, 2, 0.68, 0.25, 297, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "self._roles", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self._roles = roles.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L80_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "vector": [14, 2, 0.1914, 0.0024, 2, 0.68, 0.5, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L81_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "vector": [14, 2, 0.1938, 0.0024, 2, 0.68, 0.75, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L82_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "vector": [14, 2, 0.1962, 0.0024, 2, 0.68, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L84_C2", "label": "__contains__", "type": "function", "loc": [84, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2022, 0.0048, 1, 0.69, 0.4, 456, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__contains__", "arg_names": ["self", "participant"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __contains__(self, participant):\n return participant in self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L85_C4", "label": "return", "type": "return", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L84_C2", "vector": [13, 2, 0.2033, 0.0024, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return participant in self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L87_C2", "label": "__len__", "type": "function", "loc": [87, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2093, 0.0048, 1, 0.69, 0.5, 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 return len(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L88_C4", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L87_C2", "vector": [13, 2, 0.2105, 0.0024, 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 len(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L90_C2", "label": "__iter__", "type": "function", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2165, 0.0048, 1, 0.69, 0.6, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._participants.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L90_C2", "vector": [13, 2, 0.2177, 0.0024, 2, 0.3, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._participants.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "label": "add", "type": "function", "loc": [93, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2273, 0.012, 1, 0.69, 0.7, 241, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "add", "arg_names": ["self", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add(self, participant_id):\n \"\"\"Adds a participant by their ID (address).\"\"\"\n self._operation_queue.wavelet_add_participant(\n self._wave_id, self._wavelet_id, participant_id)\n self._participants.add(participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "vector": [8, 2, 0.2249, 0.0024, 2, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Adds a participant by their ID (address).\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L95_C4", "label": "wavelet_add_participant()", "type": "expression", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "vector": [8, 2, 0.2285, 0.0048, 2, 0.41, 0.5, 945, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_add_participant", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_add_participant", "annotation": ""}, "snippet": " self._operation_queue.wavelet_add_participant(\n self._wave_id, self._wavelet_id, participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L97_C4", "label": "add()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "vector": [8, 2, 0.2321, 0.0024, 2, 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": " self._participants.add(participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2", "label": "get_role", "type": "function", "loc": [99, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2392, 0.0072, 1, 0.69, 0.8, 36, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_role", "arg_names": ["self", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_role(self, participant_id):\n \"\"\"Return the role for the given participant_id.\"\"\"\n return self._roles.get(participant_id, Participants.ROLE_FULL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L100_C4", "label": "expression", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2", "vector": [8, 2, 0.2392, 0.0024, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the role for the given participant_id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2", "vector": [13, 2, 0.2416, 0.0024, 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._roles.get(participant_id, Participants.ROLE_FULL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "label": "set_role", "type": "function", "loc": [103, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2536, 0.0167, 1, 0.69, 0.9, 497, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "set_role", "arg_names": ["self", "participant_id", "role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_role(self, participant_id, role):\n \"\"\"Sets the role for the given participant_id.\"\"\"\n if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:\n raise ValueError(role + ' is not a valid role')\n self._operation_queue.wavelet_modify_participant_role(\n self._wave_id, self._wavelet_id, participant_id, role)\n self._roles[participant_id] = role"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L104_C4", "label": "expression", "type": "expression", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "vector": [8, 2, 0.2488, 0.0024, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets the role for the given participant_id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L105_C4", "label": "if", "type": "if", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "vector": [4, 2, 0.2524, 0.0048, 2, 0.4, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if role != Participants.ROLE_FULL and role != Participants.ROLE_READ_ONLY:\n raise ValueError(role + ' is not a valid role')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L107_C4", "label": "wavelet_modify_participant_role()", "type": "expression", "loc": [107, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "vector": [8, 2, 0.2572, 0.0048, 2, 0.4, 0.6667, 163, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_participant_role", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_participant_role", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_participant_role(\n self._wave_id, self._wavelet_id, participant_id, role)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L109_C4", "label": "assign", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "vector": [14, 2, 0.2608, 0.0024, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._roles[participant_id] = role"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2", "label": "serialize", "type": "function", "loc": [111, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "vector": [2, 1, 0.2679, 0.0072, 1, 0.69, 1.0, 50, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a list of the participants.\"\"\"\n return list(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L112_C4", "label": "expression", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2", "vector": [8, 2, 0.2679, 0.0024, 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 list of the participants.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L113_C4", "label": "return", "type": "return", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2", "vector": [13, 2, 0.2703, 0.0024, 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 list(self._participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "label": "Tags", "type": "class", "loc": [116, 153], "level": 0, "parent": null, "vector": [3, 0, 0.3218, 0.0909, 0, 0.66, 0.8571, 344, 0, 7, 0, 0, 186, 0, 10], "semantic": {"name": "Tags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Tags(object):\n \"\"\"Class modelling a list of tags.\"\"\"\n def __init__(self, tags, wave_id, wavelet_id, operation_queue):\n self._tags = list(tags)\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L117_C2", "label": "expression", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [8, 1, 0.2799, 0.0024, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class modelling a list of tags.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "label": "__init__", "type": "function", "loc": [118, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.2871, 0.012, 1, 0.47, 0.1429, 555, 0, 5, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "tags", "wave_id", "wavelet_id", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, tags, wave_id, wavelet_id, operation_queue):\n self._tags = list(tags)\n self._wave_id = wave_id\n self._wavelet_id = wavelet_id\n self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L119_C4", "label": "self._tags = list()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "vector": [14, 2, 0.2847, 0.0024, 2, 0.43, 0.0, 55, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "self._tags", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " self._tags = list(tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L120_C4", "label": "self._wave_id =", "type": "assigned_variable", "loc": [120, 120], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "vector": [14, 2, 0.2871, 0.0024, 2, 0.43, 0.3333, 26, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wave_id = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L121_C4", "label": "self._wavelet_id =", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "vector": [14, 2, 0.2895, 0.0024, 2, 0.43, 0.6667, 575, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._wavelet_id = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L122_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "vector": [14, 2, 0.2919, 0.0024, 2, 0.43, 1.0, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L124_C2", "label": "__getitem__", "type": "function", "loc": [124, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.2978, 0.0048, 1, 0.47, 0.2857, 698, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getitem__", "arg_names": ["self", "index"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getitem__(self, index):\n return self._tags[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L124_C2", "vector": [13, 2, 0.299, 0.0024, 2, 0.29, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._tags[index]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L127_C2", "label": "__len__", "type": "function", "loc": [127, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.305, 0.0048, 1, 0.47, 0.4286, 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 return len(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L128_C4", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L127_C2", "vector": [13, 2, 0.3062, 0.0024, 2, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L130_C2", "label": "__iter__", "type": "function", "loc": [130, 131], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.3122, 0.0048, 1, 0.47, 0.5714, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self._tags.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L131_C4", "label": "return", "type": "return", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L130_C2", "vector": [13, 2, 0.3134, 0.0024, 2, 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._tags.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "label": "append", "type": "function", "loc": [133, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.3266, 0.0191, 1, 0.47, 0.7143, 243, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": ["self", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def append(self, tag):\n \"\"\"Appends a tag if it doesn't already exist.\"\"\"\n tag = util.force_unicode(tag)\n if tag in self._tags:\n return\n self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag)\n self._tags.append(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L134_C4", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "vector": [8, 2, 0.3206, 0.0024, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends a tag if it doesn't already exist.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L135_C4", "label": "tag = force_unicode()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "vector": [14, 2, 0.323, 0.0024, 2, 0.31, 0.25, 732, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " tag = util.force_unicode(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L136_C4", "label": "if", "type": "if", "loc": [136, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "vector": [4, 2, 0.3266, 0.0048, 2, 0.31, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in self._tags:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L137_C6", "label": "return", "type": "return", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L136_C4", "vector": [13, 3, 0.3278, 0.0024, 3, 0.9, 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_1135:Expr_L138_C4", "label": "wavelet_modify_tag()", "type": "expression", "loc": [138, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "vector": [8, 2, 0.3313, 0.0048, 2, 0.31, 0.75, 271, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_tag", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L140_C4", "label": "append()", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "vector": [8, 2, 0.3349, 0.0024, 2, 0.31, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self._tags.append(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "label": "remove", "type": "function", "loc": [142, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.3481, 0.0191, 1, 0.47, 0.8571, 185, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "remove", "arg_names": ["self", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def remove(self, tag):\n \"\"\"Removes a tag if it exists.\"\"\"\n tag = util.force_unicode(tag)\n if not tag in self._tags:\n return\n self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag, modify_how='remove')\n self._tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L143_C4", "label": "expression", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "vector": [8, 2, 0.3421, 0.0024, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Removes a tag if it exists.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L144_C4", "label": "tag = force_unicode()", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "vector": [14, 2, 0.3445, 0.0024, 2, 0.0, 0.25, 732, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " tag = util.force_unicode(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L145_C4", "label": "if", "type": "if", "loc": [145, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "vector": [4, 2, 0.3481, 0.0048, 2, 0.0, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not tag in self._tags:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L146_C6", "label": "return", "type": "return", "loc": [146, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L145_C4", "vector": [13, 3, 0.3493, 0.0024, 3, 0.74, 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_1135:Expr_L147_C4", "label": "wavelet_modify_tag()", "type": "expression", "loc": [147, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "vector": [8, 2, 0.3529, 0.0048, 2, 0.0, 0.75, 271, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_tag", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " self._operation_queue.wavelet_modify_tag(\n self._wave_id, self._wavelet_id, tag, modify_how='remove')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L149_C4", "label": "remove()", "type": "expression", "loc": [149, 149], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "vector": [8, 2, 0.3565, 0.0024, 2, 0.0, 1.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " self._tags.remove(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2", "label": "serialize", "type": "function", "loc": [151, 153], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "vector": [2, 1, 0.3636, 0.0072, 1, 0.47, 1.0, 50, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Returns a list of tags.\"\"\"\n return list(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L152_C4", "label": "expression", "type": "expression", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2", "vector": [8, 2, 0.3636, 0.0024, 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 a list of tags.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L153_C4", "label": "return", "type": "return", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2", "vector": [13, 2, 0.366, 0.0024, 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 list(self._tags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "label": "Wavelet", "type": "class", "loc": [156, 418], "level": 0, "parent": null, "vector": [3, 0, 0.6866, 0.6292, 0, 0.66, 1.0, 108, 0, 24, 0, 0, 186, 0, 45], "semantic": {"name": "Wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Wavelet(object):\n \"\"\"Models a single wavelet.\n\n A single wavelet is composed of metadata, participants, and its blips.\n To guarantee that all blips are available, specify Context.ALL for events.\n \"\"\"\n\n def __init__(self, json, blips, robot, operation_queue):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L157_C2", "label": "expression", "type": "expression", "loc": [157, 161], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [8, 1, 0.3804, 0.012, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Models a single wavelet.\n\n A single wavelet is composed of metadata, participants, and its blips.\n To guarantee that all blips are available, specify Context.ALL for events.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "label": "__init__", "type": "function", "loc": [163, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.4366, 0.0957, 1, 0.54, 0.0385, 555, 0, 5, 0, 0, 0, 0, 15], "semantic": {"name": "__init__", "arg_names": ["self", "json", "blips", "robot", "operation_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, blips, robot, operation_queue):\n \"\"\"Inits this wavelet with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n blips: a dictionary object that can be used to resolve blips.\n robot: the robot owning this wavelet.\n operation_queue: an OperationQueue object to be used to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L164_C4", "label": "expression", "type": "expression", "loc": [164, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [8, 2, 0.4019, 0.0215, 2, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this wavelet with JSON data.\n\n Args:\n json: JSON data dictionary from Wave server.\n blips: a dictionary object that can be used to resolve blips.\n robot: the robot owning this wavelet.\n operation_queue: an OperationQueue object to be used to\n send any generated operations to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L173_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4139, 0.0024, 2, 0.13, 0.0625, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L174_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4163, 0.0024, 2, 0.13, 0.125, 689, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L175_C4", "label": "self._wave_id = get()", "type": "assigned_variable", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4187, 0.0024, 2, 0.13, 0.1875, 26, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wave_id = json.get('waveId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L176_C4", "label": "self._wavelet_id = get()", "type": "assigned_variable", "loc": [176, 176], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4211, 0.0024, 2, 0.13, 0.25, 575, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._wavelet_id = json.get('waveletId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L177_C4", "label": "self._creator = get()", "type": "assigned_variable", "loc": [177, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4234, 0.0024, 2, 0.13, 0.3125, 777, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._creator", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creator = json.get('creator')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L178_C4", "label": "self._creation_time = get()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4258, 0.0024, 2, 0.13, 0.375, 128, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._creation_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._creation_time = json.get('creationTime', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L179_C4", "label": "self._data_documents = DataDocs()", "type": "assigned_variable", "loc": [179, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4318, 0.0096, 2, 0.13, 0.4375, 408, 3, 4, 0, 0, 119, 10, 2], "semantic": {"name": "self._data_documents", "arg_names": [], "import_names": [], "rhs_call_name": "DataDocs", "annotation": ""}, "snippet": " self._data_documents = DataDocs(json.get('dataDocuments', {}),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L183_C4", "label": "self._last_modified_time = get()", "type": "assigned_variable", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4378, 0.0024, 2, 0.13, 0.5, 351, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._last_modified_time = json.get('lastModifiedTime')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L184_C4", "label": "self._participants = Participants()", "type": "assigned_variable", "loc": [184, 188], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.445, 0.012, 2, 0.13, 0.5625, 462, 3, 5, 0, 0, 0, 10, 3], "semantic": {"name": "self._participants", "arg_names": [], "import_names": [], "rhs_call_name": "Participants", "annotation": ""}, "snippet": " self._participants = Participants(json.get('participants', []),\n json.get('participantRoles', {}),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L189_C4", "label": "self._title = get()", "type": "assigned_variable", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4522, 0.0024, 2, 0.13, 0.625, 209, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self._title", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._title = json.get('title', '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L190_C4", "label": "self._tags = Tags()", "type": "assigned_variable", "loc": [190, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4581, 0.0096, 2, 0.13, 0.6875, 55, 3, 4, 0, 0, 344, 10, 2], "semantic": {"name": "self._tags", "arg_names": [], "import_names": [], "rhs_call_name": "Tags", "annotation": ""}, "snippet": " self._tags = Tags(json.get('tags', []),\n self._wave_id,\n self._wavelet_id,\n operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L195_C4", "label": "self._raw_data =", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4665, 0.0024, 2, 0.13, 0.75, 496, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L196_C4", "label": "self._blips = Blips()", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4689, 0.0024, 2, 0.13, 0.8125, 720, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "self._blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " self._blips = blip.Blips(blips)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L197_C4", "label": "self._root_blip_id = get()", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4713, 0.0024, 2, 0.13, 0.875, 450, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self._root_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self._root_blip_id = json.get('rootBlipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4", "label": "if", "type": "if", "loc": [198, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [4, 2, 0.4773, 0.0096, 2, 0.13, 0.9375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._root_blip_id and self._root_blip_id in self._blips:\n self._root_blip = self._blips[self._root_blip_id]\n else:\n self._root_blip = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L199_C6", "label": "self._root_blip =", "type": "assigned_variable", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4", "vector": [14, 3, 0.4761, 0.0024, 3, 0.52, 0.0, 895, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip = self._blips[self._root_blip_id]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L201_C6", "label": "self._root_blip =", "type": "assigned_variable", "loc": [201, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4", "vector": [14, 3, 0.4809, 0.0024, 3, 0.52, 1.0, 895, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L202_C4", "label": "self._robot_address =", "type": "assigned_variable", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "vector": [14, 2, 0.4833, 0.0024, 2, 0.13, 1.0, 195, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot_address = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2", "label": "wavelet_id", "type": "function", "loc": [205, 207], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.4928, 0.0072, 1, 0.54, 0.0769, 269, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_id(self):\n \"\"\"Returns this wavelet's id.\"\"\"\n return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L206_C4", "label": "expression", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2", "vector": [8, 2, 0.4928, 0.0024, 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 this wavelet's id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L207_C4", "label": "return", "type": "return", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2", "vector": [13, 2, 0.4952, 0.0024, 2, 0.03, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2", "label": "wave_id", "type": "function", "loc": [210, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5048, 0.0072, 1, 0.54, 0.1154, 347, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "wave_id", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wave_id(self):\n \"\"\"Returns this wavelet's parent wave id.\"\"\"\n return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L211_C4", "label": "expression", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2", "vector": [8, 2, 0.5048, 0.0024, 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 this wavelet's parent wave id.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L212_C4", "label": "return", "type": "return", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2", "vector": [13, 2, 0.5072, 0.0024, 2, 0.31, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2", "label": "creator", "type": "function", "loc": [215, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5167, 0.0072, 1, 0.54, 0.1538, 608, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creator", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creator(self):\n \"\"\"Returns the participant id of the creator of this wavelet.\"\"\"\n return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L216_C4", "label": "expression", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2", "vector": [8, 2, 0.5167, 0.0024, 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 participant id of the creator of this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L217_C4", "label": "return", "type": "return", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2", "vector": [13, 2, 0.5191, 0.0024, 2, 0.34, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2", "label": "creation_time", "type": "function", "loc": [220, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5287, 0.0072, 1, 0.54, 0.1923, 217, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "creation_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def creation_time(self):\n \"\"\"Returns the time that this wavelet was first created in milliseconds.\"\"\"\n return self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L221_C4", "label": "expression", "type": "expression", "loc": [221, 221], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2", "vector": [8, 2, 0.5287, 0.0024, 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 time that this wavelet was first created in milliseconds.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L222_C4", "label": "return", "type": "return", "loc": [222, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2", "vector": [13, 2, 0.5311, 0.0024, 2, 0.83, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2", "label": "data_documents", "type": "function", "loc": [225, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5407, 0.0072, 1, 0.54, 0.2308, 739, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "data_documents", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def data_documents(self):\n \"\"\"Returns the data documents for this wavelet based on key name.\"\"\"\n return self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L226_C4", "label": "expression", "type": "expression", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2", "vector": [8, 2, 0.5407, 0.0024, 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 data documents for this wavelet based on key name.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L227_C4", "label": "return", "type": "return", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2", "vector": [13, 2, 0.5431, 0.0024, 2, 0.86, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "label": "domain", "type": "function", "loc": [230, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5574, 0.0167, 1, 0.54, 0.2692, 438, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "domain", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def domain(self):\n \"\"\"Return the domain that wavelet belongs to.\"\"\"\n p = self._wave_id.find('!')\n if p == -1:\n return None\n else:\n return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L231_C4", "label": "expression", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "vector": [8, 2, 0.5526, 0.0024, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return the domain that wavelet belongs to.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L232_C4", "label": "p = find()", "type": "assigned_variable", "loc": [232, 232], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "vector": [14, 2, 0.555, 0.0024, 2, 0.18, 0.5, 491, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "p", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " p = self._wave_id.find('!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4", "label": "if", "type": "if", "loc": [233, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "vector": [4, 2, 0.561, 0.0096, 2, 0.18, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if p == -1:\n return None\n else:\n return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L234_C6", "label": "return", "type": "return", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4", "vector": [13, 3, 0.5598, 0.0024, 3, 0.96, 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_1135:Return_L236_C6", "label": "return", "type": "return", "loc": [236, 236], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4", "vector": [13, 3, 0.5646, 0.0024, 3, 0.96, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._wave_id[:p]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2", "label": "last_modified_time", "type": "function", "loc": [239, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5742, 0.0072, 1, 0.54, 0.3077, 538, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "last_modified_time", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def last_modified_time(self):\n \"\"\"Returns the time that this wavelet was last modified in ms.\"\"\"\n return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L240_C4", "label": "expression", "type": "expression", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2", "vector": [8, 2, 0.5742, 0.0024, 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 the time that this wavelet was last modified in ms.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L241_C4", "label": "return", "type": "return", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2", "vector": [13, 2, 0.5766, 0.0024, 2, 0.23, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2", "label": "participants", "type": "function", "loc": [244, 246], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5861, 0.0072, 1, 0.54, 0.3462, 572, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "participants", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def participants(self):\n \"\"\"Returns a set of participants on this wavelet.\"\"\"\n return self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L245_C4", "label": "expression", "type": "expression", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2", "vector": [8, 2, 0.5861, 0.0024, 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 set of participants on this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L246_C4", "label": "return", "type": "return", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2", "vector": [13, 2, 0.5885, 0.0024, 2, 0.93, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2", "label": "tags", "type": "function", "loc": [249, 251], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.5981, 0.0072, 1, 0.54, 0.3846, 487, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "tags", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def tags(self):\n \"\"\"Returns a list of tags for this wavelet.\"\"\"\n return self._tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L250_C4", "label": "expression", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2", "vector": [8, 2, 0.5981, 0.0024, 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 a list of tags for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L251_C4", "label": "return", "type": "return", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2", "vector": [13, 2, 0.6005, 0.0024, 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._tags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2", "label": "robot", "type": "function", "loc": [254, 256], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.61, 0.0072, 1, 0.54, 0.4231, 735, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "robot", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot(self):\n \"\"\"The robot that owns this wavelet.\"\"\"\n return self._robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L255_C4", "label": "expression", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2", "vector": [8, 2, 0.61, 0.0024, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The robot that owns this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L256_C4", "label": "return", "type": "return", "loc": [256, 256], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2", "vector": [13, 2, 0.6124, 0.0024, 2, 0.09, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L258_C2", "label": "_get_title", "type": "function", "loc": [258, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.6184, 0.0048, 1, 0.54, 0.4615, 564, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_title", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_title(self):\n return self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L259_C4", "label": "return", "type": "return", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L258_C2", "vector": [13, 2, 0.6196, 0.0024, 2, 0.81, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "label": "_set_title", "type": "function", "loc": [261, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.6447, 0.0431, 1, 0.54, 0.5, 637, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "_set_title", "arg_names": ["self", "title"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_title(self, title):\n title = util.force_unicode(title)\n\n if title.find('\\n') != -1:\n raise errors.Error('Wavelet title should not contain a newline ' +\n 'character. Specified: ' + title)\n\n self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L262_C4", "label": "title = force_unicode()", "type": "assigned_variable", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "vector": [14, 2, 0.6268, 0.0024, 2, 0.98, 0.0, 48, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " title = util.force_unicode(title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L264_C4", "label": "if", "type": "if", "loc": [264, 266], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "vector": [4, 2, 0.634, 0.0072, 2, 0.98, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if title.find('\\n') != -1:\n raise errors.Error('Wavelet title should not contain a newline ' +\n 'character. Specified: ' + title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L268_C4", "label": "wavelet_set_title()", "type": "expression", "loc": [268, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "vector": [8, 2, 0.6423, 0.0048, 2, 0.98, 0.5, 132, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "wavelet_set_title", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_set_title", "annotation": ""}, "snippet": " self._operation_queue.wavelet_set_title(self.wave_id, self.wavelet_id,\n title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L270_C4", "label": "self._title =", "type": "assigned_variable", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "vector": [14, 2, 0.6459, 0.0024, 2, 0.98, 0.75, 209, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._title = title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "label": "if", "type": "if", "loc": [273, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "vector": [4, 2, 0.6591, 0.0144, 2, 0.98, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._root_blip:\n content = '\\n'\n splits = self._root_blip._content.split('\\n', 2)\n if len(splits) == 3:\n content += splits[2]\n self._root_blip._content = '\\n' + title + content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L274_C6", "label": "content =", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "vector": [14, 3, 0.6555, 0.0024, 3, 0.97, 0.0, 273, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L275_C6", "label": "splits = split()", "type": "assigned_variable", "loc": [275, 275], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "vector": [14, 3, 0.6579, 0.0024, 3, 0.97, 0.3333, 323, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "splits", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " splits = self._root_blip._content.split('\\n', 2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L276_C6", "label": "if", "type": "if", "loc": [276, 277], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "vector": [4, 3, 0.6615, 0.0048, 3, 0.97, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(splits) == 3:\n content += splits[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L278_C6", "label": "self._root_blip._content =", "type": "assigned_variable", "loc": [278, 278], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "vector": [14, 3, 0.6651, 0.0024, 3, 0.97, 1.0, 705, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._root_blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._root_blip._content = '\\n' + title + content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L281_C2", "label": "title = property()", "type": "assigned_variable", "loc": [281, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [14, 1, 0.6734, 0.0048, 1, 0.54, 0.5385, 48, 3, 3, 0, 0, 244, 10, 1], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " title = property(_get_title, _set_title,\n doc='Get or set the title of the wavelet.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L284_C2", "label": "_get_robot_address", "type": "function", "loc": [284, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.6806, 0.0048, 1, 0.54, 0.5769, 416, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "_get_robot_address", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_robot_address(self):\n return self._robot_address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L285_C4", "label": "return", "type": "return", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L284_C2", "vector": [13, 2, 0.6818, 0.0024, 2, 0.63, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._robot_address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2", "label": "_set_robot_address", "type": "function", "loc": [287, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.6902, 0.0096, 1, 0.54, 0.6154, 733, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "_set_robot_address", "arg_names": ["self", "address"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _set_robot_address(self, address):\n if self._robot_address:\n raise errors.Error('robot address already set')\n self._robot_address = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L288_C4", "label": "if", "type": "if", "loc": [288, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2", "vector": [4, 2, 0.6902, 0.0048, 2, 0.84, 0.0, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._robot_address:\n raise errors.Error('robot address already set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L290_C4", "label": "self._robot_address =", "type": "assigned_variable", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2", "vector": [14, 2, 0.6938, 0.0024, 2, 0.84, 1.0, 195, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot_address = address"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L292_C2", "label": "robot_address = property()", "type": "assigned_variable", "loc": [292, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [14, 1, 0.6998, 0.0048, 1, 0.54, 0.6538, 559, 3, 3, 0, 0, 244, 10, 1], "semantic": {"name": "robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "property", "annotation": ""}, "snippet": " robot_address = property(_get_robot_address, _set_robot_address,\n doc='Get or set the address of the current robot.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2", "label": "root_blip", "type": "function", "loc": [296, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.7105, 0.0072, 1, 0.54, 0.6923, 139, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "root_blip", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def root_blip(self):\n \"\"\"Returns this wavelet's root blip.\"\"\"\n return self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L297_C4", "label": "expression", "type": "expression", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2", "vector": [8, 2, 0.7105, 0.0024, 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 this wavelet's root blip.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L298_C4", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2", "vector": [13, 2, 0.7129, 0.0024, 2, 0.55, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2", "label": "blips", "type": "function", "loc": [301, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.7225, 0.0072, 1, 0.54, 0.7308, 391, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "blips", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blips(self):\n \"\"\"Returns the blips for this wavelet.\"\"\"\n return self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L302_C4", "label": "expression", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2", "vector": [8, 2, 0.7225, 0.0024, 2, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns the blips for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L303_C4", "label": "return", "type": "return", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2", "vector": [13, 2, 0.7249, 0.0024, 2, 0.11, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2", "label": "get_operation_queue", "type": "function", "loc": [305, 307], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.7321, 0.0072, 1, 0.54, 0.7692, 481, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_operation_queue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_operation_queue(self):\n \"\"\"Returns the OperationQueue for this wavelet.\"\"\"\n return self._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L306_C4", "label": "expression", "type": "expression", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2", "vector": [8, 2, 0.7321, 0.0024, 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 OperationQueue for this wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L307_C4", "label": "return", "type": "return", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2", "vector": [13, 2, 0.7344, 0.0024, 2, 0.84, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2", "label": "serialize", "type": "function", "loc": [309, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.7536, 0.0311, 1, 0.54, 0.8077, 50, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Return a dict of the wavelet properties.\"\"\"\n return {'waveId': self._wave_id,\n 'waveletId': self._wavelet_id,\n 'creator': self._creator,\n 'creationTime': self._creation_time,\n 'dataDocuments': self._data_documents.serialize(),\n 'lastModifiedTime': self._last_modified_time,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L310_C4", "label": "expression", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2", "vector": [8, 2, 0.7416, 0.0024, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a dict of the wavelet properties.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L311_C4", "label": "return", "type": "return", "loc": [311, 321], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2", "vector": [13, 2, 0.756, 0.0263, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 6, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'waveId': self._wave_id,\n 'waveletId': self._wavelet_id,\n 'creator': self._creator,\n 'creationTime': self._creation_time,\n 'dataDocuments': self._data_documents.serialize(),\n 'lastModifiedTime': self._last_modified_time,\n 'participants': self._participants.serialize(),\n 'title': self._title,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "label": "proxy_for", "type": "function", "loc": [323, 352], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.8074, 0.0718, 1, 0.54, 0.8462, 365, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy_for_id):\n \"\"\"Return a view on this wavelet that will proxy for the specified id.\n\n A shallow copy of the current wavelet is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L324_C4", "label": "expression", "type": "expression", "loc": [324, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [8, 2, 0.7871, 0.0263, 2, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a view on this wavelet that will proxy for the specified id.\n\n A shallow copy of the current wavelet is returned with the proxy_for_id\n set. Any modifications made to this copy will be done using the\n proxy_for_id, i.e. the robot+<proxy_for_id>@appspot.com address will\n be used.\n\n If the wavelet was retrieved using the Active Robot API, that is"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L335_C4", "label": "add_proxying_participant()", "type": "expression", "loc": [335, 335], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [8, 2, 0.8014, 0.0024, 2, 0.76, 0.0667, 586, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add_proxying_participant", "arg_names": [], "import_names": [], "rhs_call_name": "add_proxying_participant", "annotation": ""}, "snippet": " self.add_proxying_participant(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L336_C4", "label": "operation_queue = proxy_for()", "type": "assigned_variable", "loc": [336, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8038, 0.0024, 2, 0.76, 0.1333, 919, 3, 1, 0, 0, 365, 10, 2], "semantic": {"name": "operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "proxy_for", "annotation": ""}, "snippet": " operation_queue = self.get_operation_queue().proxy_for(proxy_for_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L337_C4", "label": "res = Wavelet()", "type": "assigned_variable", "loc": [337, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8098, 0.0096, 2, 0.76, 0.2, 413, 3, 4, 0, 0, 108, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Wavelet", "annotation": ""}, "snippet": " res = Wavelet(json={},\n blips={},\n robot=self.robot,\n operation_queue=operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L341_C4", "label": "res._wave_id =", "type": "assigned_variable", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8158, 0.0024, 2, 0.76, 0.2667, 620, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wave_id = self._wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L342_C4", "label": "res._wavelet_id =", "type": "assigned_variable", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8182, 0.0024, 2, 0.76, 0.3333, 917, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._wavelet_id = self._wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L343_C4", "label": "res._creator =", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8206, 0.0024, 2, 0.76, 0.4, 937, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creator = self._creator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L344_C4", "label": "res._creation_time =", "type": "assigned_variable", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.823, 0.0024, 2, 0.76, 0.4667, 642, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._creation_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._creation_time = self._creation_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L345_C4", "label": "res._data_documents =", "type": "assigned_variable", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8254, 0.0024, 2, 0.76, 0.5333, 595, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._data_documents", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._data_documents = self._data_documents"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L346_C4", "label": "res._last_modified_time =", "type": "assigned_variable", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8278, 0.0024, 2, 0.76, 0.6, 383, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._last_modified_time", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._last_modified_time = self._last_modified_time"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L347_C4", "label": "res._participants =", "type": "assigned_variable", "loc": [347, 347], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8301, 0.0024, 2, 0.76, 0.6667, 901, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._participants = self._participants"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L348_C4", "label": "res._title =", "type": "assigned_variable", "loc": [348, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8325, 0.0024, 2, 0.76, 0.7333, 429, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._title = self._title"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L349_C4", "label": "res._raw_data =", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8349, 0.0024, 2, 0.76, 0.8, 53, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._raw_data = self._raw_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L350_C4", "label": "res._blips =", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8373, 0.0024, 2, 0.76, 0.8667, 426, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._blips = self._blips"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L351_C4", "label": "res._root_blip =", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [14, 2, 0.8397, 0.0024, 2, 0.76, 0.9333, 616, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._root_blip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._root_blip = self._root_blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L352_C4", "label": "return", "type": "return", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "vector": [13, 2, 0.8421, 0.0024, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "label": "add_proxying_participant", "type": "function", "loc": [354, 375], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.872, 0.0526, 1, 0.54, 0.8846, 586, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "add_proxying_participant", "arg_names": ["self", "id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_proxying_participant(self, id):\n \"\"\"Ads a proxying participant to the wave.\n\n Proxying participants are of the form robot+proxy@domain.com. This\n convenience method constructs this id and then calls participants.add.\n \"\"\"\n if not self.robot_address:\n raise errors.Error("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L355_C4", "label": "expression", "type": "expression", "loc": [355, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [8, 2, 0.8541, 0.012, 2, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Ads a proxying participant to the wave.\n\n Proxying participants are of the form robot+proxy@domain.com. This\n convenience method constructs this id and then calls participants.add.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L360_C4", "label": "if", "type": "if", "loc": [360, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [4, 2, 0.8636, 0.0072, 2, 0.7, 0.1667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self.robot_address:\n raise errors.Error(\n 'Need a robot address to add a proxying for participant')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L363_C4", "label": "robotid, domain = split()", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [14, 2, 0.8684, 0.0024, 2, 0.7, 0.3333, 736, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "robotid, domain", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " robotid, domain = self.robot_address.split('@', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4", "label": "if", "type": "if", "loc": [364, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [4, 2, 0.8744, 0.0096, 2, 0.7, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '#' in robotid:\n robotid, version = robotid.split('#')\n else:\n version = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L365_C6", "label": "robotid, version = split()", "type": "assigned_variable", "loc": [365, 365], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4", "vector": [14, 3, 0.8732, 0.0024, 3, 0.85, 0.0, 243, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "robotid, version", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " robotid, version = robotid.split('#')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L367_C6", "label": "version =", "type": "assigned_variable", "loc": [367, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4", "vector": [14, 3, 0.878, 0.0024, 3, 0.85, 1.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_1135:If_L368_C4", "label": "if", "type": "if", "loc": [368, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [4, 2, 0.884, 0.0096, 2, 0.7, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '+' in robotid:\n newid = robotid.split('+', 1)[0] + '+' + id\n else:\n newid = robotid + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L369_C6", "label": "newid =", "type": "assigned_variable", "loc": [369, 369], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L368_C4", "vector": [14, 3, 0.8828, 0.0024, 3, 0.65, 0.0, 189, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newid = robotid.split('+', 1)[0] + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L371_C6", "label": "newid =", "type": "assigned_variable", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L368_C4", "vector": [14, 3, 0.8876, 0.0024, 3, 0.65, 1.0, 189, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newid = robotid + '+' + id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L372_C4", "label": "if", "type": "if", "loc": [372, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [4, 2, 0.8911, 0.0048, 2, 0.7, 0.8333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version:\n newid += '#' + version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L375_C4", "label": "add()", "type": "expression", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "vector": [8, 2, 0.8971, 0.0024, 2, 0.7, 1.0, 241, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "add", "arg_names": [], "import_names": [], "rhs_call_name": "add", "annotation": ""}, "snippet": " self.participants.add(newid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "label": "submit_with", "type": "function", "loc": [377, 386], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.9127, 0.0239, 1, 0.54, 0.9231, 936, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "submit_with", "arg_names": ["self", "other_wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def submit_with(self, other_wavelet):\n \"\"\"Submit this wavelet when the passed other wavelet is submited.\n\n wavelets constructed outside of the event callback need to\n be either explicitly submited using robot.submit(wavelet) or be\n associated with a different wavelet that will be submited or\n is part of the event callback.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L378_C4", "label": "expression", "type": "expression", "loc": [378, 384], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "vector": [8, 2, 0.9115, 0.0167, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Submit this wavelet when the passed other wavelet is submited.\n\n wavelets constructed outside of the event callback need to\n be either explicitly submited using robot.submit(wavelet) or be\n associated with a different wavelet that will be submited or\n is part of the event callback.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L385_C4", "label": "copy_operations()", "type": "expression", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "vector": [8, 2, 0.9211, 0.0024, 2, 0.01, 0.5, 938, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "copy_operations", "arg_names": [], "import_names": [], "rhs_call_name": "copy_operations", "annotation": ""}, "snippet": " other_wavelet._operation_queue.copy_operations(self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L386_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "vector": [14, 2, 0.9234, 0.0024, 2, 0.01, 1.0, 689, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = other_wavelet._operation_queue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "label": "reply", "type": "function", "loc": [388, 405], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.9486, 0.0431, 1, 0.54, 0.9615, 714, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "reply", "arg_names": ["self", "initial_content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def reply(self, initial_content=None):\n \"\"\"Replies to the conversation in this wavelet.\n\n Args:\n initial_content: If set, start with this (string) content.\n\n Returns:\n A transient version of the blip that contains the reply."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L389_C4", "label": "expression", "type": "expression", "loc": [389, 396], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [8, 2, 0.939, 0.0191, 2, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Replies to the conversation in this wavelet.\n\n Args:\n initial_content: If set, start with this (string) content.\n\n Returns:\n A transient version of the blip that contains the reply.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L397_C4", "label": "if", "type": "if", "loc": [397, 398], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [4, 2, 0.951, 0.0048, 2, 0.99, 0.1667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not initial_content:\n initial_content = u'\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L398_C6", "label": "initial_content =", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L397_C4", "vector": [14, 3, 0.9522, 0.0024, 3, 0.07, 0.0, 348, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "initial_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " initial_content = u'\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L399_C4", "label": "initial_content = force_unicode()", "type": "assigned_variable", "loc": [399, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [14, 2, 0.9545, 0.0024, 2, 0.99, 0.3333, 348, 3, 1, 0, 0, 870, 10, 1], "semantic": {"name": "initial_content", "arg_names": [], "import_names": [], "rhs_call_name": "force_unicode", "annotation": ""}, "snippet": " initial_content = util.force_unicode(initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L400_C4", "label": "blip_data = wavelet_append_blip()", "type": "assigned_variable", "loc": [400, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [14, 2, 0.9581, 0.0048, 2, 0.99, 0.5, 892, 3, 3, 0, 0, 420, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_append_blip", "annotation": ""}, "snippet": " blip_data = self._operation_queue.wavelet_append_blip(\n self.wave_id, self.wavelet_id, initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L403_C4", "label": "instance = Blip()", "type": "assigned_variable", "loc": [403, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [14, 2, 0.9641, 0.0024, 2, 0.99, 0.6667, 255, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "instance", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " instance = blip.Blip(blip_data, self._blips, self._operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L404_C4", "label": "_add()", "type": "expression", "loc": [404, 404], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [8, 2, 0.9665, 0.0024, 2, 0.99, 0.8333, 840, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_add", "arg_names": [], "import_names": [], "rhs_call_name": "_add", "annotation": ""}, "snippet": " self._blips._add(instance)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L405_C4", "label": "return", "type": "return", "loc": [405, 405], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "vector": [13, 2, 0.9689, 0.0024, 2, 0.99, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return instance"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "label": "delete", "type": "function", "loc": [407, 418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "vector": [2, 1, 0.9868, 0.0287, 1, 0.54, 1.0, 266, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "delete", "arg_names": ["self", "todelete"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def delete(self, todelete):\n \"\"\"Remove a blip from this wavelet.\n\n Args:\n todelete: either a blip or a blip id to be removed.\n \"\"\"\n if isinstance(todelete, blip.Blip):\n blip_id = todelete.blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L408_C4", "label": "expression", "type": "expression", "loc": [408, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "vector": [8, 2, 0.9809, 0.012, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Remove a blip from this wavelet.\n\n Args:\n todelete: either a blip or a blip id to be removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4", "label": "if", "type": "if", "loc": [413, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "vector": [4, 2, 0.9916, 0.0096, 2, 0.82, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(todelete, blip.Blip):\n blip_id = todelete.blip_id\n else:\n blip_id = todelete"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L414_C6", "label": "blip_id =", "type": "assigned_variable", "loc": [414, 414], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4", "vector": [14, 3, 0.9904, 0.0024, 3, 0.07, 0.0, 161, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_id = todelete.blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L416_C6", "label": "blip_id =", "type": "assigned_variable", "loc": [416, 416], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4", "vector": [14, 3, 0.9952, 0.0024, 3, 0.07, 1.0, 161, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_id = todelete"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L417_C4", "label": "blip_delete()", "type": "expression", "loc": [417, 417], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "vector": [8, 2, 0.9976, 0.0024, 2, 0.82, 0.6667, 397, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "blip_delete", "arg_names": [], "import_names": [], "rhs_call_name": "blip_delete", "annotation": ""}, "snippet": " self._operation_queue.blip_delete(self.wave_id, self.wavelet_id, blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L418_C4", "label": "_remove_with_id()", "type": "expression", "loc": [418, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "vector": [8, 2, 1.0, 0.0024, 2, 0.82, 1.0, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": [], "import_names": [], "rhs_call_name": "_remove_with_id", "annotation": ""}, "snippet": " self._blips._remove_with_id(blip_id)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L40_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L41_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L55_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L63_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L103_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L117_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L124_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L130_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L137_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L133_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L145_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L146_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L142_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L176_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L199_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L201_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L210_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L215_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L221_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L220_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L222_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L225_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L232_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L234_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L233_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L236_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L239_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L249_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L254_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L258_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L258_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L274_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L275_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L276_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L278_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L281_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L284_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L284_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L287_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L292_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L296_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L301_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L303_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L305_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L307_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L309_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L336_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L342_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L348_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L323_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L365_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L364_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L367_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L369_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L371_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L354_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L385_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L377_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L386_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L397_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L397_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L398_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L399_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L400_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L403_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L404_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L388_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Return_L405_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:ClassDef_L156_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L414_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:If_L413_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Assign_L416_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L417_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1135:FunctionDef_L407_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1135:Expr_L418_C4"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Elements are non-text bits living in blips like images, gadgets etc.
This module defines the Element class and the derived classes.
"""
import base64
import logging
import sys
import util
class Element(object):
"""Elements are non-text content within a document.
These are generally abstracted from the Robot. Although a Robot can query the
properties of an element it can only interact with the specific types that
the element represents.
Properties of elements are both accessible directly (image.url) and through
the properties dictionary (image.properties['url']). In general Element
should not be instantiated by robots, but rather rely on the derived classes.
"""
# INLINE_BLIP_TYPE is not a separate type since it shouldn't be instantiated,
# only be used for introspection
INLINE_BLIP_TYPE = "INLINE_BLIP"
def __init__(self, element_type, **properties):
"""Initializes self with the specified type and any properties.
Args:
element_type: string typed member of ELEMENT_TYPE
properties: either a dictionary of initial properties, or a dictionary
with just one member properties that is itself a dictionary of
properties. This allows us to both use
e = Element(atype, prop1=val1, prop2=prop2...)
and
e = Element(atype, properties={prop1:val1, prop2:prop2..})
"""
if len(properties) == 1 and 'properties' in properties:
properties = properties['properties']
self._type = element_type
# as long as the operation_queue of an element in None, it is
# unattached. After an element is acquired by a blip, the blip
# will set the operation_queue to make sure all changes to the
# element are properly send to the server.
self._operation_queue = None
self._properties = properties.copy()
@property
def type(self):
"""The type of this element."""
return self._type
@classmethod
def from_json(cls, json):
"""Class method to instantiate an Element based on a json string."""
etype = json['type']
props = json['properties'].copy()
element_class = ALL.get(etype)
if not element_class:
# Unknown type. Server could be newer than we are
return Element(element_type=etype, properties=props)
return element_class.from_props(props)
def get(self, key, default=None):
"""Standard get interface."""
return self._properties.get(key, default)
def __getattr__(self, key):
return self._properties[key]
def serialize(self):
"""Custom serializer for Elements."""
return util.serialize({'properties': util.non_none_dict(self._properties),
'type': self._type})
class Input(Element):
"""A single-line input element."""
class_type = 'INPUT'
def __init__(self, name, value=''):
super(Input, self).__init__(Input.class_type,
name=name,
value=value,
default_value=value)
@classmethod
def from_props(cls, props):
return Input(name=props.get('name'), value=props.get('value'))
class Check(Element):
"""A checkbox element."""
class_type = 'CHECK'
def __init__(self, name, value=''):
super(Check, self).__init__(Check.class_type,
name=name, value=value, default_value=value)
@classmethod
def from_props(cls, props):
return Check(name=props.get('name'), value=props.get('value'))
class Button(Element):
"""A button element."""
class_type = 'BUTTON'
def __init__(self, name, value):
super(Button, self).__init__(Button.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return Button(name=props.get('name'), value=props.get('value'))
class Label(Element):
"""A label element."""
class_type = 'LABEL'
def __init__(self, label_for, caption):
super(Label, self).__init__(Label.class_type,
name=label_for, value=caption)
@classmethod
def from_props(cls, props):
return Label(label_for=props.get('name'), caption=props.get('value'))
class RadioButton(Element):
"""A radio button element."""
class_type = 'RADIO_BUTTON'
def __init__(self, name, group):
super(RadioButton, self).__init__(RadioButton.class_type,
name=name, value=group)
@classmethod
def from_props(cls, props):
return RadioButton(name=props.get('name'), group=props.get('value'))
class RadioButtonGroup(Element):
"""A group of radio buttons."""
class_type = 'RADIO_BUTTON_GROUP'
def __init__(self, name, value):
super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return RadioButtonGroup(name=props.get('name'), value=props.get('value'))
class Password(Element):
"""A password element."""
class_type = 'PASSWORD'
def __init__(self, name, value):
super(Password, self).__init__(Password.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return Password(name=props.get('name'), value=props.get('value'))
class TextArea(Element):
"""A text area element."""
class_type = 'TEXTAREA'
def __init__(self, name, value):
super(TextArea, self).__init__(TextArea.class_type,
name=name, value=value)
@classmethod
def from_props(cls, props):
return TextArea(name=props.get('name'), value=props.get('value'))
class Line(Element):
"""A line element.
Note that Lines are represented in the text as newlines.
"""
class_type = 'LINE'
# Possible line types:
#: Designates line as H1, largest heading.
TYPE_H1 = 'h1'
#: Designates line as H2 heading.
TYPE_H2 = 'h2'
#: Designates line as H3 heading.
TYPE_H3 = 'h3'
#: Designates line as H4 heading.
TYPE_H4 = 'h4'
#: Designates line as H5, smallest heading.
TYPE_H5 = 'h5'
#: Designates line as a bulleted list item.
TYPE_LI = 'li'
# Possible values for align
#: Sets line alignment to left.
ALIGN_LEFT = 'l'
#: Sets line alignment to right.
ALIGN_RIGHT = 'r'
#: Sets line alignment to centered.
ALIGN_CENTER = 'c'
#: Sets line alignment to justified.
ALIGN_JUSTIFIED = 'j'
def __init__(self,
line_type=None,
indent=None,
alignment=None,
direction=None):
super(Line, self).__init__(Line.class_type,
lineType=line_type,
indent=indent,
alignment=alignment,
direction=direction)
@classmethod
def from_props(cls, props):
return Line(line_type=props.get('lineType'),
indent=props.get('indent'),
alignment=props.get('alignment'),
direction=props.get('direction'))
class Gadget(Element):
"""A gadget element."""
class_type = 'GADGET'
def __init__(self, url, props=None):
if props is None:
props = {}
props['url'] = url
super(Gadget, self).__init__(Gadget.class_type, properties=props)
@classmethod
def from_props(cls, props):
return Gadget(props.get('url'), props)
def serialize(self):
"""Gadgets allow for None values."""
return {'properties': self._properties, 'type': self._type}
def keys(self):
"""Get the valid keys for this gadget."""
return [x for x in self._properties.keys() if x != 'url']
class Installer(Element):
"""An installer element."""
class_type = 'INSTALLER'
def __init__(self, manifest):
super(Installer, self).__init__(Installer.class_type, manifest=manifest)
@classmethod
def from_props(cls, props):
return Installer(props.get('manifest'))
class Image(Element):
"""An image element."""
class_type = 'IMAGE'
def __init__(self, url='', width=None, height=None,
attachmentId=None, caption=None):
super(Image, self).__init__(Image.class_type, url=url, width=width,
height=height, attachmentId=attachmentId, caption=caption)
@classmethod
def from_props(cls, props):
props = dict([(key.encode('utf-8'), value)
for key, value in props.items()])
return apply(Image, [], props)
class Attachment(Element):
"""An attachment element.
To create a new attachment, caption and data are needed.
mimeType, attachmentId and attachmentUrl are sent via events.
"""
class_type = 'ATTACHMENT'
def __init__(self, caption=None, data=None, mimeType=None, attachmentId=None,
attachmentUrl=None):
Attachment.originalData = data
super(Attachment, self).__init__(Attachment.class_type, caption=caption,
data=data, mimeType=mimeType, attachmentId=attachmentId,
attachmentUrl=attachmentUrl)
def __getattr__(self, key):
if key and key == 'data':
return Attachment.originalData
return super(Attachment, self).__getattr__(key)
@classmethod
def from_props(cls, props):
props = dict([(key.encode('utf-8'), value)
for key, value in props.items()])
return apply(Attachment, [], props)
def serialize(self):
"""Serializes the attachment object into JSON.
The attachment data is base64 encoded.
"""
if self.data:
self._properties['data'] = base64.encodestring(self.data)
return super(Attachment, self).serialize()
def is_element(cls):
"""Returns whether the passed class is an element."""
try:
if not issubclass(cls, Element):
return False
h = hasattr(cls, 'class_type')
return hasattr(cls, 'class_type')
except TypeError:
return False
ALL = dict([(item.class_type, item) for item in globals().copy().values()
if is_element(item)])
| ajibawa-2023/Python-Code-Large/train/row_1136 | 165 | 367 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 20], "level": 0, "parent": null, "vector": [8, 0, 0.0504, 0.0109, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Elements are non-text bits living in blips like images, gadgets etc.\n\nThis module defines the Element class and the derived classes.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Import_L23_C0", "label": "base64 import base64", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0627, 0.0027, 0, 0.66, 0.05, 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_1136:Import_L24_C0", "label": "logging import logging", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0654, 0.0027, 0, 0.66, 0.1, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Import_L25_C0", "label": "sys import sys", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0681, 0.0027, 0, 0.66, 0.15, 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_1136:Import_L27_C0", "label": "util import util", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0736, 0.0027, 0, 0.66, 0.2, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "label": "Element", "type": "class", "loc": [30, 96], "level": 0, "parent": null, "vector": [3, 0, 0.1717, 0.1826, 0, 0.66, 0.25, 873, 0, 6, 0, 0, 186, 0, 9], "semantic": {"name": "Element", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Element(object):\n \"\"\"Elements are non-text content within a document.\n\n These are generally abstracted from the Robot. Although a Robot can query the\n properties of an element it can only interact with the specific types that\n the element represents.\n\n Properties of elements are both accessible directly (image.url) and through"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [8, 1, 0.0967, 0.0272, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Elements are non-text content within a document.\n\n These are generally abstracted from the Robot. Although a Robot can query the\n properties of an element it can only interact with the specific types that\n the element represents.\n\n Properties of elements are both accessible directly (image.url) and through\n the properties dictionary (image.properties['url']). In general Element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L44_C2", "label": "INLINE_BLIP_TYPE =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [14, 1, 0.1199, 0.0027, 1, 0.73, 0.1429, 568, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "INLINE_BLIP_TYPE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " INLINE_BLIP_TYPE = \"INLINE_BLIP\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "label": "__init__", "type": "function", "loc": [46, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.1526, 0.0572, 1, 0.73, 0.2857, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "element_type", "properties"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, element_type, **properties):\n \"\"\"Initializes self with the specified type and any properties.\n\n Args:\n element_type: string typed member of ELEMENT_TYPE\n properties: either a dictionary of initial properties, or a dictionary\n with just one member properties that is itself a dictionary of\n properties. This allows us to both use"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "vector": [8, 2, 0.1417, 0.03, 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 self with the specified type and any properties.\n\n Args:\n element_type: string typed member of ELEMENT_TYPE\n properties: either a dictionary of initial properties, or a dictionary\n with just one member properties that is itself a dictionary of\n properties. This allows us to both use\n e = Element(atype, prop1=val1, prop2=prop2...)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "vector": [4, 2, 0.1594, 0.0054, 2, 0.39, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(properties) == 1 and 'properties' in properties:\n properties = properties['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L59_C6", "label": "properties =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L58_C4", "vector": [14, 3, 0.1608, 0.0027, 3, 0.25, 0.0, 147, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "properties", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " properties = properties['properties']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L60_C4", "label": "self._type =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "vector": [14, 2, 0.1635, 0.0027, 2, 0.39, 0.5, 313, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._type = element_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L65_C4", "label": "self._operation_queue =", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "vector": [14, 2, 0.1771, 0.0027, 2, 0.39, 0.75, 689, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._operation_queue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L66_C4", "label": "self._properties = copy()", "type": "assigned_variable", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "vector": [14, 2, 0.1798, 0.0027, 2, 0.39, 1.0, 400, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "self._properties", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " self._properties = properties.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2", "label": "type", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.1907, 0.0082, 1, 0.73, 0.4286, 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 \"\"\"The type of this element.\"\"\"\n return self._type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2", "vector": [8, 2, 0.1907, 0.0027, 2, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The type of this element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L71_C4", "label": "return", "type": "return", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2", "vector": [13, 2, 0.1935, 0.0027, 2, 0.88, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "label": "from_json", "type": "function", "loc": [74, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.2153, 0.03, 1, 0.73, 0.5714, 975, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_json", "arg_names": ["cls", "json"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_json(cls, json):\n \"\"\"Class method to instantiate an Element based on a json string.\"\"\"\n etype = json['type']\n props = json['properties'].copy()\n\n element_class = ALL.get(etype)\n if not element_class:\n # Unknown type. Server could be newer than we are"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L75_C4", "label": "expression", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [8, 2, 0.2044, 0.0027, 2, 0.63, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Class method to instantiate an Element based on a json string.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L76_C4", "label": "etype =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [14, 2, 0.2071, 0.0027, 2, 0.63, 0.2, 370, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "etype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " etype = json['type']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L77_C4", "label": "props = copy()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [14, 2, 0.2098, 0.0027, 2, 0.63, 0.4, 675, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " props = json['properties'].copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L79_C4", "label": "element_class = get()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [14, 2, 0.2153, 0.0027, 2, 0.63, 0.6, 249, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "element_class", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " element_class = ALL.get(etype)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L80_C4", "label": "if", "type": "if", "loc": [80, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [4, 2, 0.2207, 0.0082, 2, 0.63, 0.8, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not element_class:\n # Unknown type. Server could be newer than we are\n return Element(element_type=etype, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L82_C6", "label": "return", "type": "return", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L80_C4", "vector": [13, 3, 0.2234, 0.0027, 3, 0.96, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Element(element_type=etype, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L84_C4", "label": "return", "type": "return", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "vector": [13, 2, 0.2289, 0.0027, 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 element_class.from_props(props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2", "label": "get", "type": "function", "loc": [86, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.2371, 0.0082, 1, 0.73, 0.7143, 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 \"\"\"Standard get interface.\"\"\"\n return self._properties.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L87_C4", "label": "expression", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2", "vector": [8, 2, 0.2371, 0.0027, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Standard get interface.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L88_C4", "label": "return", "type": "return", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2", "vector": [13, 2, 0.2398, 0.0027, 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._properties.get(key, default)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L90_C2", "label": "__getattr__", "type": "function", "loc": [90, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.2466, 0.0054, 1, 0.73, 0.8571, 210, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n return self._properties[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L91_C4", "label": "return", "type": "return", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L90_C2", "vector": [13, 2, 0.248, 0.0027, 2, 0.02, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._properties[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2", "label": "serialize", "type": "function", "loc": [93, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "vector": [2, 1, 0.2575, 0.0109, 1, 0.73, 1.0, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Custom serializer for Elements.\"\"\"\n return util.serialize({'properties': util.non_none_dict(self._properties),\n 'type': self._type})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L94_C4", "label": "expression", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2", "vector": [8, 2, 0.2561, 0.0027, 2, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Custom serializer for Elements.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L95_C4", "label": "return", "type": "return", "loc": [95, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2", "vector": [13, 2, 0.2602, 0.0054, 2, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return util.serialize({'properties': util.non_none_dict(self._properties),\n 'type': self._type})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "label": "Input", "type": "class", "loc": [99, 112], "level": 0, "parent": null, "vector": [3, 0, 0.2875, 0.0381, 0, 0.66, 0.3, 35, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Input", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Input(Element):\n \"\"\"A single-line input element.\"\"\"\n\n class_type = 'INPUT'\n\n def __init__(self, name, value=''):\n super(Input, self).__init__(Input.class_type,\n name=name,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L100_C2", "label": "expression", "type": "expression", "loc": [100, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "vector": [8, 1, 0.2725, 0.0027, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A single-line input element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L102_C2", "label": "class_type =", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "vector": [14, 1, 0.2779, 0.0027, 1, 0.85, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'INPUT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L104_C2", "label": "__init__", "type": "function", "loc": [104, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "vector": [2, 1, 0.2888, 0.0136, 1, 0.85, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value=''):\n super(Input, self).__init__(Input.class_type,\n name=name,\n value=value,\n default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L105_C4", "label": "__init__()", "type": "expression", "loc": [105, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L104_C2", "vector": [8, 2, 0.2902, 0.0109, 2, 0.74, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Input, self).__init__(Input.class_type,\n name=name,\n value=value,\n default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L111_C2", "label": "from_props", "type": "function", "loc": [111, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "vector": [2, 1, 0.3038, 0.0054, 1, 0.85, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Input(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L112_C4", "label": "return", "type": "return", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L111_C2", "vector": [13, 2, 0.3052, 0.0027, 2, 0.71, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Input(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "label": "Check", "type": "class", "loc": [115, 126], "level": 0, "parent": null, "vector": [3, 0, 0.3283, 0.0327, 0, 0.66, 0.35, 153, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Check", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Check(Element):\n \"\"\"A checkbox element.\"\"\"\n\n class_type = 'CHECK'\n\n def __init__(self, name, value=''):\n super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L116_C2", "label": "expression", "type": "expression", "loc": [116, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "vector": [8, 1, 0.3161, 0.0027, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A checkbox element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L118_C2", "label": "class_type =", "type": "assigned_variable", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "vector": [14, 1, 0.3215, 0.0027, 1, 0.42, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'CHECK'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L120_C2", "label": "__init__", "type": "function", "loc": [120, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "vector": [2, 1, 0.3297, 0.0082, 1, 0.42, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value=''):\n super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L121_C4", "label": "__init__()", "type": "expression", "loc": [121, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L120_C2", "vector": [8, 2, 0.3311, 0.0054, 2, 0.76, 0.0, 555, 3, 4, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Check, self).__init__(Check.class_type,\n name=name, value=value, default_value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L125_C2", "label": "from_props", "type": "function", "loc": [125, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "vector": [2, 1, 0.342, 0.0054, 1, 0.42, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Check(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L126_C4", "label": "return", "type": "return", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L125_C2", "vector": [13, 2, 0.3433, 0.0027, 2, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Check(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "label": "Button", "type": "class", "loc": [129, 140], "level": 0, "parent": null, "vector": [3, 0, 0.3665, 0.0327, 0, 0.66, 0.4, 608, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Button", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Button(Element):\n \"\"\"A button element.\"\"\"\n\n class_type = 'BUTTON'\n\n def __init__(self, name, value):\n super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L130_C2", "label": "expression", "type": "expression", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "vector": [8, 1, 0.3542, 0.0027, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A button element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L132_C2", "label": "class_type =", "type": "assigned_variable", "loc": [132, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "vector": [14, 1, 0.3597, 0.0027, 1, 0.19, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'BUTTON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L134_C2", "label": "__init__", "type": "function", "loc": [134, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "vector": [2, 1, 0.3678, 0.0082, 1, 0.19, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L135_C4", "label": "__init__()", "type": "expression", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L134_C2", "vector": [8, 2, 0.3692, 0.0054, 2, 0.98, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Button, self).__init__(Button.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L139_C2", "label": "from_props", "type": "function", "loc": [139, 140], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "vector": [2, 1, 0.3801, 0.0054, 1, 0.19, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Button(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L140_C4", "label": "return", "type": "return", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L139_C2", "vector": [13, 2, 0.3815, 0.0027, 2, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Button(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "label": "Label", "type": "class", "loc": [143, 154], "level": 0, "parent": null, "vector": [3, 0, 0.4046, 0.0327, 0, 0.66, 0.45, 413, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Label", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Label(Element):\n \"\"\"A label element.\"\"\"\n\n class_type = 'LABEL'\n\n def __init__(self, label_for, caption):\n super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L144_C2", "label": "expression", "type": "expression", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "vector": [8, 1, 0.3924, 0.0027, 1, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A label element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L146_C2", "label": "class_type =", "type": "assigned_variable", "loc": [146, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "vector": [14, 1, 0.3978, 0.0027, 1, 0.12, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'LABEL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L148_C2", "label": "__init__", "type": "function", "loc": [148, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "vector": [2, 1, 0.406, 0.0082, 1, 0.12, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "label_for", "caption"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, label_for, caption):\n super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L149_C4", "label": "__init__()", "type": "expression", "loc": [149, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L148_C2", "vector": [8, 2, 0.4074, 0.0054, 2, 0.83, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Label, self).__init__(Label.class_type,\n name=label_for, value=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L153_C2", "label": "from_props", "type": "function", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "vector": [2, 1, 0.4183, 0.0054, 1, 0.12, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Label(label_for=props.get('name'), caption=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L154_C4", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L153_C2", "vector": [13, 2, 0.4196, 0.0027, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Label(label_for=props.get('name'), caption=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "label": "RadioButton", "type": "class", "loc": [157, 168], "level": 0, "parent": null, "vector": [3, 0, 0.4428, 0.0327, 0, 0.66, 0.5, 536, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "RadioButton", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RadioButton(Element):\n \"\"\"A radio button element.\"\"\"\n\n class_type = 'RADIO_BUTTON'\n\n def __init__(self, name, group):\n super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L158_C2", "label": "expression", "type": "expression", "loc": [158, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "vector": [8, 1, 0.4305, 0.0027, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A radio button element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L160_C2", "label": "class_type =", "type": "assigned_variable", "loc": [160, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "vector": [14, 1, 0.436, 0.0027, 1, 0.82, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'RADIO_BUTTON'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L162_C2", "label": "__init__", "type": "function", "loc": [162, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "vector": [2, 1, 0.4441, 0.0082, 1, 0.82, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "group"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, group):\n super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L163_C4", "label": "__init__()", "type": "expression", "loc": [163, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L162_C2", "vector": [8, 2, 0.4455, 0.0054, 2, 0.72, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RadioButton, self).__init__(RadioButton.class_type,\n name=name, value=group)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L167_C2", "label": "from_props", "type": "function", "loc": [167, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "vector": [2, 1, 0.4564, 0.0054, 1, 0.82, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return RadioButton(name=props.get('name'), group=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L168_C4", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L167_C2", "vector": [13, 2, 0.4578, 0.0027, 2, 0.8, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RadioButton(name=props.get('name'), group=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "label": "RadioButtonGroup", "type": "class", "loc": [171, 182], "level": 0, "parent": null, "vector": [3, 0, 0.4809, 0.0327, 0, 0.66, 0.55, 254, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "RadioButtonGroup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RadioButtonGroup(Element):\n \"\"\"A group of radio buttons.\"\"\"\n\n class_type = 'RADIO_BUTTON_GROUP'\n\n def __init__(self, name, value):\n super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L172_C2", "label": "expression", "type": "expression", "loc": [172, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "vector": [8, 1, 0.4687, 0.0027, 1, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A group of radio buttons.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L174_C2", "label": "class_type =", "type": "assigned_variable", "loc": [174, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "vector": [14, 1, 0.4741, 0.0027, 1, 0.39, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'RADIO_BUTTON_GROUP'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L176_C2", "label": "__init__", "type": "function", "loc": [176, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "vector": [2, 1, 0.4823, 0.0082, 1, 0.39, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L177_C4", "label": "__init__()", "type": "expression", "loc": [177, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L176_C2", "vector": [8, 2, 0.4837, 0.0054, 2, 0.59, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(RadioButtonGroup, self).__init__(RadioButtonGroup.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L181_C2", "label": "from_props", "type": "function", "loc": [181, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "vector": [2, 1, 0.4946, 0.0054, 1, 0.39, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return RadioButtonGroup(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L181_C2", "vector": [13, 2, 0.4959, 0.0027, 2, 0.75, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return RadioButtonGroup(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "label": "Password", "type": "class", "loc": [185, 196], "level": 0, "parent": null, "vector": [3, 0, 0.5191, 0.0327, 0, 0.66, 0.6, 113, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "Password", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Password(Element):\n \"\"\"A password element.\"\"\"\n\n class_type = 'PASSWORD'\n\n def __init__(self, name, value):\n super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L186_C2", "label": "expression", "type": "expression", "loc": [186, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "vector": [8, 1, 0.5068, 0.0027, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A password element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L188_C2", "label": "class_type =", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "vector": [14, 1, 0.5123, 0.0027, 1, 0.81, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'PASSWORD'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L190_C2", "label": "__init__", "type": "function", "loc": [190, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "vector": [2, 1, 0.5204, 0.0082, 1, 0.81, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L191_C4", "label": "__init__()", "type": "expression", "loc": [191, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L190_C2", "vector": [8, 2, 0.5218, 0.0054, 2, 0.47, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Password, self).__init__(Password.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L195_C2", "label": "from_props", "type": "function", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "vector": [2, 1, 0.5327, 0.0054, 1, 0.81, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Password(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L196_C4", "label": "return", "type": "return", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L195_C2", "vector": [13, 2, 0.5341, 0.0027, 2, 0.87, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Password(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "label": "TextArea", "type": "class", "loc": [199, 210], "level": 0, "parent": null, "vector": [3, 0, 0.5572, 0.0327, 0, 0.66, 0.65, 69, 0, 2, 0, 0, 873, 0, 5], "semantic": {"name": "TextArea", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TextArea(Element):\n \"\"\"A text area element.\"\"\"\n\n class_type = 'TEXTAREA'\n\n def __init__(self, name, value):\n super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L200_C2", "label": "expression", "type": "expression", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "vector": [8, 1, 0.545, 0.0027, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A text area element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L202_C2", "label": "class_type =", "type": "assigned_variable", "loc": [202, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "vector": [14, 1, 0.5504, 0.0027, 1, 0.7, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'TEXTAREA'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L204_C2", "label": "__init__", "type": "function", "loc": [204, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "vector": [2, 1, 0.5586, 0.0082, 1, 0.7, 0.6667, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "name", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, name, value):\n super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L205_C4", "label": "__init__()", "type": "expression", "loc": [205, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L204_C2", "vector": [8, 2, 0.5599, 0.0054, 2, 0.19, 0.0, 555, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(TextArea, self).__init__(TextArea.class_type,\n name=name, value=value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L209_C2", "label": "from_props", "type": "function", "loc": [209, 210], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "vector": [2, 1, 0.5708, 0.0054, 1, 0.7, 1.0, 559, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return TextArea(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L210_C4", "label": "return", "type": "return", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L209_C2", "vector": [13, 2, 0.5722, 0.0027, 2, 0.37, 0.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return TextArea(name=props.get('name'), value=props.get('value'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "label": "Line", "type": "class", "loc": [213, 261], "level": 0, "parent": null, "vector": [3, 0, 0.6458, 0.1335, 0, 0.66, 0.7, 650, 0, 2, 0, 0, 873, 0, 7], "semantic": {"name": "Line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Line(Element):\n \"\"\"A line element.\n \n Note that Lines are represented in the text as newlines.\n \"\"\"\n\n class_type = 'LINE'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L214_C2", "label": "expression", "type": "expression", "loc": [214, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [8, 1, 0.5872, 0.0109, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A line element.\n \n Note that Lines are represented in the text as newlines.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L219_C2", "label": "class_type =", "type": "assigned_variable", "loc": [219, 219], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.5967, 0.0027, 1, 0.25, 0.0769, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'LINE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L223_C2", "label": "TYPE_H1 =", "type": "assigned_variable", "loc": [223, 223], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6076, 0.0027, 1, 0.25, 0.1538, 970, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H1 = 'h1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L225_C2", "label": "TYPE_H2 =", "type": "assigned_variable", "loc": [225, 225], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6131, 0.0027, 1, 0.25, 0.2308, 383, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H2 = 'h2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L227_C2", "label": "TYPE_H3 =", "type": "assigned_variable", "loc": [227, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6185, 0.0027, 1, 0.25, 0.3077, 794, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H3", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H3 = 'h3'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L229_C2", "label": "TYPE_H4 =", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.624, 0.0027, 1, 0.25, 0.3846, 947, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H4", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H4 = 'h4'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L231_C2", "label": "TYPE_H5 =", "type": "assigned_variable", "loc": [231, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6294, 0.0027, 1, 0.25, 0.4615, 476, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_H5", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_H5 = 'h5'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L233_C2", "label": "TYPE_LI =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6349, 0.0027, 1, 0.25, 0.5385, 347, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TYPE_LI", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " TYPE_LI = 'li'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L237_C2", "label": "ALIGN_LEFT =", "type": "assigned_variable", "loc": [237, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6458, 0.0027, 1, 0.25, 0.6154, 917, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_LEFT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_LEFT = 'l'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L239_C2", "label": "ALIGN_RIGHT =", "type": "assigned_variable", "loc": [239, 239], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6512, 0.0027, 1, 0.25, 0.6923, 971, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_RIGHT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_RIGHT = 'r'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L241_C2", "label": "ALIGN_CENTER =", "type": "assigned_variable", "loc": [241, 241], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6567, 0.0027, 1, 0.25, 0.7692, 448, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_CENTER", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_CENTER = 'c'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L243_C2", "label": "ALIGN_JUSTIFIED =", "type": "assigned_variable", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [14, 1, 0.6621, 0.0027, 1, 0.25, 0.8462, 400, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALIGN_JUSTIFIED", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALIGN_JUSTIFIED = 'j'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L245_C2", "label": "__init__", "type": "function", "loc": [245, 254], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [2, 1, 0.6798, 0.0272, 1, 0.25, 0.9231, 555, 0, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "line_type", "indent", "alignment", "direction"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self,\n line_type=None,\n indent=None,\n alignment=None,\n direction=None):\n super(Line, self).__init__(Line.class_type,\n lineType=line_type,\n indent=indent,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L250_C4", "label": "__init__()", "type": "expression", "loc": [250, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L245_C2", "vector": [8, 2, 0.6866, 0.0136, 2, 0.88, 0.0, 555, 3, 5, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Line, self).__init__(Line.class_type,\n lineType=line_type,\n indent=indent,\n alignment=alignment,\n direction=direction)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L257_C2", "label": "from_props", "type": "function", "loc": [257, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "vector": [2, 1, 0.7057, 0.0136, 1, 0.25, 1.0, 559, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Line(line_type=props.get('lineType'),\n indent=props.get('indent'),\n alignment=props.get('alignment'),\n direction=props.get('direction'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L257_C2", "vector": [13, 2, 0.7071, 0.0109, 2, 0.7, 0.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Line(line_type=props.get('lineType'),\n indent=props.get('indent'),\n alignment=props.get('alignment'),\n direction=props.get('direction'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "label": "Gadget", "type": "class", "loc": [264, 285], "level": 0, "parent": null, "vector": [3, 0, 0.748, 0.0599, 0, 0.66, 0.75, 136, 0, 4, 0, 0, 873, 0, 5], "semantic": {"name": "Gadget", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Gadget(Element):\n \"\"\"A gadget element.\"\"\"\n\n class_type = 'GADGET'\n\n def __init__(self, url, props=None):\n if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L265_C2", "label": "expression", "type": "expression", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [8, 1, 0.7221, 0.0027, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"A gadget element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L267_C2", "label": "class_type =", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [14, 1, 0.7275, 0.0027, 1, 0.57, 0.2, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'GADGET'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "label": "__init__", "type": "function", "loc": [269, 273], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [2, 1, 0.7384, 0.0136, 1, 0.57, 0.4, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "url", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, url, props=None):\n if props is None:\n props = {}\n props['url'] = url\n super(Gadget, self).__init__(Gadget.class_type, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L270_C4", "label": "if", "type": "if", "loc": [270, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "vector": [4, 2, 0.7371, 0.0054, 2, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L271_C6", "label": "props =", "type": "assigned_variable", "loc": [271, 271], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L270_C4", "vector": [14, 3, 0.7384, 0.0027, 3, 0.86, 0.0, 675, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L272_C4", "label": "assign", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "vector": [14, 2, 0.7411, 0.0027, 2, 0.2, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['url'] = url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L273_C4", "label": "__init__()", "type": "expression", "loc": [273, 273], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "vector": [8, 2, 0.7439, 0.0027, 2, 0.2, 1.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Gadget, self).__init__(Gadget.class_type, properties=props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L276_C2", "label": "from_props", "type": "function", "loc": [276, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [2, 1, 0.7534, 0.0054, 1, 0.57, 0.6, 559, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Gadget(props.get('url'), props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L277_C4", "label": "return", "type": "return", "loc": [277, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L276_C2", "vector": [13, 2, 0.7548, 0.0027, 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 Gadget(props.get('url'), props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2", "label": "serialize", "type": "function", "loc": [279, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [2, 1, 0.7629, 0.0082, 1, 0.57, 0.8, 50, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Gadgets allow for None values.\"\"\"\n return {'properties': self._properties, 'type': self._type}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L280_C4", "label": "expression", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2", "vector": [8, 2, 0.7629, 0.0027, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Gadgets allow for None values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L281_C4", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2", "vector": [13, 2, 0.7657, 0.0027, 2, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'properties': self._properties, 'type': self._type}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2", "label": "keys", "type": "function", "loc": [283, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "vector": [2, 1, 0.7738, 0.0082, 1, 0.57, 1.0, 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 \"\"\"Get the valid keys for this gadget.\"\"\"\n return [x for x in self._properties.keys() if x != 'url']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2", "vector": [8, 2, 0.7738, 0.0027, 2, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get the valid keys for this gadget.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L285_C4", "label": "return", "type": "return", "loc": [285, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2", "vector": [13, 2, 0.7766, 0.0027, 2, 0.59, 1.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [x for x in self._properties.keys() if x != 'url']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "label": "Installer", "type": "class", "loc": [288, 298], "level": 0, "parent": null, "vector": [3, 0, 0.7984, 0.03, 0, 0.66, 0.8, 426, 0, 2, 0, 0, 873, 0, 4], "semantic": {"name": "Installer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Installer(Element):\n \"\"\"An installer element.\"\"\"\n\n class_type = 'INSTALLER'\n\n def __init__(self, manifest):\n super(Installer, self).__init__(Installer.class_type, manifest=manifest)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L289_C2", "label": "expression", "type": "expression", "loc": [289, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "vector": [8, 1, 0.7875, 0.0027, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An installer element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L291_C2", "label": "class_type =", "type": "assigned_variable", "loc": [291, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "vector": [14, 1, 0.7929, 0.0027, 1, 0.61, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'INSTALLER'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L293_C2", "label": "__init__", "type": "function", "loc": [293, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "vector": [2, 1, 0.7997, 0.0054, 1, 0.61, 0.6667, 555, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "manifest"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, manifest):\n super(Installer, self).__init__(Installer.class_type, manifest=manifest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L294_C4", "label": "__init__()", "type": "expression", "loc": [294, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L293_C2", "vector": [8, 2, 0.8011, 0.0027, 2, 0.58, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Installer, self).__init__(Installer.class_type, manifest=manifest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L297_C2", "label": "from_props", "type": "function", "loc": [297, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "vector": [2, 1, 0.8106, 0.0054, 1, 0.61, 1.0, 559, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n return Installer(props.get('manifest'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L298_C4", "label": "return", "type": "return", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L297_C2", "vector": [13, 2, 0.812, 0.0027, 2, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Installer(props.get('manifest'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "label": "Image", "type": "class", "loc": [302, 316], "level": 0, "parent": null, "vector": [3, 0, 0.842, 0.0409, 0, 0.66, 0.85, 721, 0, 2, 0, 0, 873, 0, 6], "semantic": {"name": "Image", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Image(Element):\n \"\"\"An image element.\"\"\"\n\n class_type = 'IMAGE'\n\n def __init__(self, url='', width=None, height=None,\n attachmentId=None, caption=None):\n super(Image, self).__init__(Image.class_type, url=url, width=width,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L303_C2", "label": "expression", "type": "expression", "loc": [303, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "vector": [8, 1, 0.8256, 0.0027, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An image element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L305_C2", "label": "class_type =", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "vector": [14, 1, 0.8311, 0.0027, 1, 0.2, 0.3333, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'IMAGE'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L307_C2", "label": "__init__", "type": "function", "loc": [307, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "vector": [2, 1, 0.8406, 0.0109, 1, 0.2, 0.6667, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "url", "width", "height", "attachmentId", "caption"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, url='', width=None, height=None,\n attachmentId=None, caption=None):\n super(Image, self).__init__(Image.class_type, url=url, width=width,\n height=height, attachmentId=attachmentId, caption=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L309_C4", "label": "__init__()", "type": "expression", "loc": [309, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L307_C2", "vector": [8, 2, 0.8433, 0.0054, 2, 0.1, 0.0, 555, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Image, self).__init__(Image.class_type, url=url, width=width,\n height=height, attachmentId=attachmentId, caption=caption)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2", "label": "from_props", "type": "function", "loc": [313, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "vector": [2, 1, 0.8569, 0.0109, 1, 0.2, 1.0, 559, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])\n return apply(Image, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L314_C4", "label": "props = dict()", "type": "assigned_variable", "loc": [314, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2", "vector": [14, 2, 0.8569, 0.0054, 2, 0.73, 0.0, 675, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L316_C4", "label": "return", "type": "return", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2", "vector": [13, 2, 0.861, 0.0027, 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 apply(Image, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "label": "Attachment", "type": "class", "loc": [318, 353], "level": 0, "parent": null, "vector": [3, 0, 0.9142, 0.0981, 0, 0.66, 0.9, 312, 0, 4, 0, 0, 873, 0, 11], "semantic": {"name": "Attachment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Attachment(Element):\n \"\"\"An attachment element.\n\n To create a new attachment, caption and data are needed.\n mimeType, attachmentId and attachmentUrl are sent via events.\n \"\"\"\n\n class_type = 'ATTACHMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L319_C2", "label": "expression", "type": "expression", "loc": [319, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [8, 1, 0.8747, 0.0136, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"An attachment element.\n\n To create a new attachment, caption and data are needed.\n mimeType, attachmentId and attachmentUrl are sent via events.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L325_C2", "label": "class_type =", "type": "assigned_variable", "loc": [325, 325], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [14, 1, 0.8856, 0.0027, 1, 0.55, 0.2, 936, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "class_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " class_type = 'ATTACHMENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2", "label": "__init__", "type": "function", "loc": [327, 332], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [2, 1, 0.8978, 0.0163, 1, 0.55, 0.4, 555, 0, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "caption", "data", "mimeType", "attachmentId", "attachmentUrl"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, caption=None, data=None, mimeType=None, attachmentId=None,\n attachmentUrl=None):\n Attachment.originalData = data\n super(Attachment, self).__init__(Attachment.class_type, caption=caption,\n data=data, mimeType=mimeType, attachmentId=attachmentId,\n attachmentUrl=attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L329_C4", "label": "Attachment.originalData =", "type": "assigned_variable", "loc": [329, 329], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2", "vector": [14, 2, 0.8965, 0.0027, 2, 0.48, 0.0, 667, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "Attachment.originalData", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " Attachment.originalData = data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L330_C4", "label": "__init__()", "type": "expression", "loc": [330, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2", "vector": [8, 2, 0.9019, 0.0082, 2, 0.48, 1.0, 555, 3, 6, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(Attachment, self).__init__(Attachment.class_type, caption=caption,\n data=data, mimeType=mimeType, attachmentId=attachmentId,\n attachmentUrl=attachmentUrl)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2", "label": "__getattr__", "type": "function", "loc": [334, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [2, 1, 0.9142, 0.0109, 1, 0.55, 0.6, 210, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "__getattr__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __getattr__(self, key):\n if key and key == 'data':\n return Attachment.originalData\n return super(Attachment, self).__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L335_C4", "label": "if", "type": "if", "loc": [335, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2", "vector": [4, 2, 0.9142, 0.0054, 2, 0.25, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key and key == 'data':\n return Attachment.originalData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L336_C6", "label": "return", "type": "return", "loc": [336, 336], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L335_C4", "vector": [13, 3, 0.9155, 0.0027, 3, 0.58, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return Attachment.originalData"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L337_C4", "label": "return", "type": "return", "loc": [337, 337], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2", "vector": [13, 2, 0.9183, 0.0027, 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 super(Attachment, self).__getattr__(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2", "label": "from_props", "type": "function", "loc": [340, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [2, 1, 0.9305, 0.0109, 1, 0.55, 0.8, 559, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "from_props", "arg_names": ["cls", "props"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_props(cls, props):\n props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])\n return apply(Attachment, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L341_C4", "label": "props = dict()", "type": "assigned_variable", "loc": [341, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2", "vector": [14, 2, 0.9305, 0.0054, 2, 0.82, 0.0, 675, 3, 1, 0, 0, 827, 10, 3], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " props = dict([(key.encode('utf-8'), value)\n for key, value in props.items()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L343_C4", "label": "return", "type": "return", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2", "vector": [13, 2, 0.9346, 0.0027, 2, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return apply(Attachment, [], props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "label": "serialize", "type": "function", "loc": [345, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "vector": [2, 1, 0.951, 0.0245, 1, 0.55, 1.0, 50, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n \"\"\"Serializes the attachment object into JSON.\n\n The attachment data is base64 encoded.\n \"\"\"\n\n if self.data:\n self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L346_C4", "label": "expression", "type": "expression", "loc": [346, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "vector": [8, 2, 0.9469, 0.0109, 2, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes the attachment object into JSON.\n\n The attachment data is base64 encoded.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L351_C4", "label": "if", "type": "if", "loc": [351, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "vector": [4, 2, 0.9578, 0.0054, 2, 0.27, 0.5, 0, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.data:\n self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L352_C6", "label": " = encodestring()", "type": "assigned_variable", "loc": [352, 352], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L351_C4", "vector": [14, 3, 0.9591, 0.0027, 3, 0.92, 0.0, 0, 3, 1, 0, 0, 133, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "encodestring", "annotation": ""}, "snippet": " self._properties['data'] = base64.encodestring(self.data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L353_C4", "label": "return", "type": "return", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "vector": [13, 2, 0.9619, 0.0027, 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(Attachment, self).serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L356_C0", "label": "is_element", "type": "function", "loc": [356, 364], "level": 0, "parent": null, "vector": [2, 0, 0.9809, 0.0245, 0, 0.66, 0.95, 780, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "is_element", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_element(cls):\n \"\"\"Returns whether the passed class is an element.\"\"\"\n try:\n if not issubclass(cls, Element):\n return False\n h = hasattr(cls, 'class_type')\n return hasattr(cls, 'class_type')\n except TypeError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L357_C2", "label": "expression", "type": "expression", "loc": [357, 357], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L356_C0", "vector": [8, 1, 0.9728, 0.0027, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns whether the passed class is an element.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "label": "try", "type": "try", "loc": [358, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L356_C0", "vector": [7, 1, 0.9837, 0.0191, 1, 0.87, 1.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if not issubclass(cls, Element):\n return False\n h = hasattr(cls, 'class_type')\n return hasattr(cls, 'class_type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L359_C4", "label": "if", "type": "if", "loc": [359, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "vector": [4, 2, 0.9796, 0.0054, 2, 0.34, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not issubclass(cls, Element):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L360_C6", "label": "return", "type": "return", "loc": [360, 360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L359_C4", "vector": [13, 3, 0.9809, 0.0027, 3, 0.35, 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_1136:Assign_L361_C4", "label": "h = hasattr()", "type": "assigned_variable", "loc": [361, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "vector": [14, 2, 0.9837, 0.0027, 2, 0.34, 0.5, 686, 3, 2, 0, 0, 720, 10, 1], "semantic": {"name": "h", "arg_names": [], "import_names": [], "rhs_call_name": "hasattr", "annotation": ""}, "snippet": " h = hasattr(cls, 'class_type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L362_C4", "label": "return", "type": "return", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "vector": [13, 2, 0.9864, 0.0027, 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 hasattr(cls, 'class_type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L364_C4", "label": "return", "type": "return", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "vector": [13, 2, 0.9918, 0.0027, 2, 0.34, 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_1136:Assign_L366_C0", "label": "ALL = dict()", "type": "assigned_variable", "loc": [366, 367], "level": 0, "parent": null, "vector": [14, 0, 0.9986, 0.0054, 0, 0.66, 1.0, 431, 3, 1, 0, 0, 827, 10, 5], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": "ALL = dict([(item.class_type, item) for item in globals().copy().values()\n if is_element(item)])"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L86_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L93_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L99_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L134_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L129_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L148_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L148_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L149_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L143_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L153_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L153_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L158_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L160_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L157_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L172_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L174_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L176_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L176_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L177_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L181_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L181_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L186_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L185_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L195_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L195_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L202_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L204_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L204_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L199_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L209_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L209_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L219_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L223_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L225_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L227_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L233_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L237_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L239_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L241_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L243_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L245_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L245_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L213_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L257_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L257_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L265_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L271_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L272_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L269_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L276_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L276_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L289_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L291_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L288_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L297_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L297_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L303_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L305_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L302_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L313_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L319_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L325_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L329_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L327_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L335_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L335_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L336_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L334_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:ClassDef_L318_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L352_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L345_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L356_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Expr_L357_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:FunctionDef_L356_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:If_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L360_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Assign_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L362_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1136:Try_L358_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1136:Return_L364_C4"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Script to run all unit tests in this package."""
import blip_test
import element_test
import module_test_runner
import ops_test
import robot_test
import util_test
import wavelet_test
def RunUnitTests():
"""Runs all registered unit tests."""
test_runner = module_test_runner.ModuleTestRunner()
test_runner.modules = [
blip_test,
element_test,
ops_test,
robot_test,
util_test,
wavelet_test,
]
test_runner.RunAllTests()
if __name__ == "__main__":
RunUnitTests()
| ajibawa-2023/Python-Code-Large/train/row_1137 | 15 | 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_1137:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.3864, 0.0227, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Script to run all unit tests in this package.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L20_C0", "label": "blip_test import blip_test", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.4545, 0.0227, 0, 0.66, 0.1111, 740, 0, 1, 0, 0, 740, 0, 0], "semantic": {"name": "blip_test", "arg_names": [], "import_names": ["blip_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L21_C0", "label": "element_test import element_test", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.4773, 0.0227, 0, 0.66, 0.2222, 514, 0, 1, 0, 0, 514, 0, 0], "semantic": {"name": "element_test", "arg_names": [], "import_names": ["element_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L22_C0", "label": "module_test_runner import module_test_runner", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.0227, 0, 0.66, 0.3333, 497, 0, 1, 0, 0, 497, 0, 0], "semantic": {"name": "module_test_runner", "arg_names": [], "import_names": ["module_test_runner"], "rhs_call_name": "", "annotation": ""}, "snippet": "import module_test_runner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L23_C0", "label": "ops_test import ops_test", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.5227, 0.0227, 0, 0.66, 0.4444, 123, 0, 1, 0, 0, 123, 0, 0], "semantic": {"name": "ops_test", "arg_names": [], "import_names": ["ops_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L24_C0", "label": "robot_test import robot_test", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.5455, 0.0227, 0, 0.66, 0.5556, 406, 0, 1, 0, 0, 406, 0, 0], "semantic": {"name": "robot_test", "arg_names": [], "import_names": ["robot_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import robot_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L25_C0", "label": "util_test import util_test", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.5682, 0.0227, 0, 0.66, 0.6667, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "util_test", "arg_names": [], "import_names": ["util_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Import_L26_C0", "label": "wavelet_test import wavelet_test", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.5909, 0.0227, 0, 0.66, 0.7778, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "wavelet_test", "arg_names": [], "import_names": ["wavelet_test"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wavelet_test"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "label": "RunUnitTests", "type": "function", "loc": [29, 40], "level": 0, "parent": null, "vector": [2, 0, 0.7841, 0.2727, 0, 0.66, 0.8889, 450, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "RunUnitTests", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RunUnitTests():\n \"\"\"Runs all registered unit tests.\"\"\"\n test_runner = module_test_runner.ModuleTestRunner()\n test_runner.modules = [\n blip_test,\n element_test,\n ops_test,\n robot_test,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L30_C2", "label": "expression", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "vector": [8, 1, 0.6818, 0.0227, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Runs all registered unit tests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Assign_L31_C2", "label": "test_runner = ModuleTestRunner()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "vector": [14, 1, 0.7045, 0.0227, 1, 0.85, 0.3333, 530, 3, 0, 0, 0, 109, 10, 1], "semantic": {"name": "test_runner", "arg_names": [], "import_names": [], "rhs_call_name": "ModuleTestRunner", "annotation": ""}, "snippet": " test_runner = module_test_runner.ModuleTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Assign_L32_C2", "label": "test_runner.modules =", "type": "assigned_variable", "loc": [32, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "vector": [14, 1, 0.8068, 0.1818, 1, 0.85, 0.6667, 523, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "test_runner.modules", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " test_runner.modules = [\n blip_test,\n element_test,\n ops_test,\n robot_test,\n util_test,\n wavelet_test,\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L40_C2", "label": "RunAllTests()", "type": "expression", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "vector": [8, 1, 0.9091, 0.0227, 1, 0.85, 1.0, 52, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "RunAllTests", "arg_names": [], "import_names": [], "rhs_call_name": "RunAllTests", "annotation": ""}, "snippet": " test_runner.RunAllTests()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:If_L43_C0", "label": "if", "type": "if", "loc": [43, 44], "level": 0, "parent": null, "vector": [4, 0, 0.9886, 0.0455, 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 RunUnitTests()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L44_C2", "label": "RunUnitTests()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1137:If_L43_C0", "vector": [8, 1, 1.0, 0.0227, 1, 0.45, 0.0, 450, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "RunUnitTests", "arg_names": [], "import_names": [], "rhs_call_name": "RunUnitTests", "annotation": ""}, "snippet": " RunUnitTests()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1137:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1137:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1137:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1137:If_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1137:Expr_L44_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A module to run wave robots on app engine."""
import logging
import sys
import events
from google.appengine.api import urlfetch
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class CapabilitiesHandler(webapp.RequestHandler):
"""Handler to forward a request ot a handler of a robot."""
def __init__(self, method, contenttype):
"""Initializes this handler with a specific robot."""
self._method = method
self._contenttype = contenttype
def get(self):
"""Handles HTTP GET request."""
self.response.headers['Content-Type'] = self._contenttype
self.response.out.write(self._method())
class ProfileHandler(webapp.RequestHandler):
"""Handler to forward a request ot a handler of a robot."""
def __init__(self, method, contenttype):
"""Initializes this handler with a specific robot."""
self._method = method
self._contenttype = contenttype
def get(self):
"""Handles HTTP GET request."""
self.response.headers['Content-Type'] = self._contenttype
# Respond with proxied profile if name specified
if self.request.get('name'):
self.response.out.write(self._method(self.request.get('name')))
else:
self.response.out.write(self._method())
class RobotEventHandler(webapp.RequestHandler):
"""Handler for the dispatching of events to various handlers to a robot.
This handler only responds to post events with a JSON post body. Its primary
task is to separate out the context data from the events in the post body
and dispatch all events in order. Once all events have been dispatched
it serializes the context data and its associated operations as a response.
"""
def __init__(self, robot):
"""Initializes self with a specific robot."""
self._robot = robot
def get(self):
"""Handles the get event for debugging.
This is useful for debugging but since event bundles tend to be
rather big it often won't fit for more complex requests.
"""
ops = self.request.get('events')
if ops:
self.request.body = events
self.post()
def post(self):
"""Handles HTTP POST requests."""
json_body = self.request.body
if not json_body:
# TODO(davidbyttow): Log error?
return
# Redirect stdout to stderr while executing handlers. This way, any stray
# "print" statements in bot code go to the error logs instead of breaking
# the JSON response sent to the HTTP channel.
saved_stdout, sys.stdout = sys.stdout, sys.stderr
json_body = unicode(json_body, 'utf8')
logging.info('Incoming: %s', json_body)
json_response = self._robot.process_events(json_body)
logging.info('Outgoing: %s', json_response)
sys.stdout = saved_stdout
# Build the response.
self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
self.response.out.write(json_response.encode('utf-8'))
def operation_error_handler(event, wavelet):
"""Default operation error handler, logging what went wrong."""
if isinstance(event, events.OperationError):
logging.error('Previously operation failed: id=%s, message: %s',
event.operation_id, event.error_message)
def appengine_post(url, data, headers):
result = urlfetch.fetch(
method='POST',
url=url,
payload=data,
headers=headers,
deadline=10)
return result.status_code, result.content
class RobotVerifyTokenHandler(webapp.RequestHandler):
"""Handler for the token_verify request."""
def __init__(self, robot):
"""Initializes self with a specific robot."""
self._robot = robot
def get(self):
"""Handles the get event for debugging. Ops usually too long."""
token, st = self._robot.get_verification_token_info()
logging.info('token=%s' % token)
if token is None:
self.error(404)
self.response.out.write('No token set')
return
if not st is None:
if self.request.get('st') != st:
self.response.out.write('Invalid st value passed %s != %s' % (st, self.request.get('st')))
return
self.response.out.write(token)
def create_robot_webapp(robot, debug=False, extra_handlers=None):
"""Returns an instance of webapp.WSGIApplication with robot handlers."""
if not extra_handlers:
extra_handlers = []
return webapp.WSGIApplication([('.*/_wave/capabilities.xml',
lambda: CapabilitiesHandler(
robot.capabilities_xml,
'application/xml')),
('.*/_wave/robot/profile',
lambda: ProfileHandler(
robot.profile_json,
'application/json')),
('.*/_wave/robot/jsonrpc',
lambda: RobotEventHandler(robot)),
('.*/_wave/verify_token',
lambda: RobotVerifyTokenHandler(robot)),
] + extra_handlers,
debug=debug)
def run(robot, debug=False, log_errors=True, extra_handlers=None):
"""Sets up the webapp handlers for this robot and starts listening.
A robot is typically setup in the following steps:
1. Instantiate and define robot.
2. Register various handlers that it is interested in.
3. Call Run, which will setup the handlers for the app.
For example:
robot = Robot('Terminator',
image_url='http://www.sky.net/models/t800.png',
profile_url='http://www.sky.net/models/t800.html')
robot.register_handler(WAVELET_PARTICIPANTS_CHANGED, KillParticipant)
run(robot)
Args:
robot: the robot to run. This robot is modified to use app engines
urlfetch for posting http.
debug: Optional variable that defaults to False and is passed through
to the webapp application to determine if it should show debug info.
log_errors: Optional flag that defaults to True and determines whether
a default handlers to catch errors should be setup that uses the
app engine logging to log errors.
extra_handlers: Optional list of tuples that are passed to the webapp
to install more handlers. For example, passing
[('/about', AboutHandler),] would install an extra about handler
for the robot.
"""
# App Engine expects to construct a class with no arguments, so we
# pass a lambda that constructs the appropriate handler with
# arguments from the enclosing scope.
if log_errors:
robot.register_handler(events.OperationError, operation_error_handler)
robot.http_post = appengine_post
app = create_robot_webapp(robot, debug, extra_handlers)
run_wsgi_app(app)
| ajibawa-2023/Python-Code-Large/train/row_1138 | 90 | 201 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0846, 0.005, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"A module to run wave robots on app engine.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Import_L20_C0", "label": "logging import logging", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0995, 0.005, 0, 0.66, 0.0714, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Import_L21_C0", "label": "sys import sys", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1045, 0.005, 0, 0.66, 0.1429, 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_1138:Import_L23_C0", "label": "events import events", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1144, 0.005, 0, 0.66, 0.2143, 830, 0, 1, 0, 0, 830, 0, 0], "semantic": {"name": "events", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ImportFrom_L25_C0", "label": "from google.appengine.api import urlfetch", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1244, 0.005, 0, 0.66, 0.2857, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["urlfetch"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import urlfetch"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ImportFrom_L26_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.1294, 0.005, 0, 0.66, 0.3571, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ImportFrom_L27_C0", "label": "from google.appengine.ext.webapp.util import run_wsgi_app", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1343, 0.005, 0, 0.66, 0.4286, 327, 0, 1, 0, 0, 327, 0, 0], "semantic": {"name": "google.appengine.ext.webapp.util", "arg_names": [], "import_names": ["run_wsgi_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp.util import run_wsgi_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "label": "CapabilitiesHandler", "type": "class", "loc": [30, 41], "level": 0, "parent": null, "vector": [3, 0, 0.1766, 0.0597, 0, 0.66, 0.5, 333, 0, 2, 0, 0, 256, 0, 2], "semantic": {"name": "CapabilitiesHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CapabilitiesHandler(webapp.RequestHandler):\n \"\"\"Handler to forward a request ot a handler of a robot.\"\"\"\n\n def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "vector": [8, 1, 0.1542, 0.005, 1, 0.75, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler to forward a request ot a handler of a robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "label": "__init__", "type": "function", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "vector": [2, 1, 0.1716, 0.0199, 1, 0.75, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "contenttype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L34_C4", "label": "expression", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "vector": [8, 2, 0.1692, 0.005, 2, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this handler with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L35_C4", "label": "self._method =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "vector": [14, 2, 0.1741, 0.005, 2, 0.67, 0.5, 910, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L36_C4", "label": "self._contenttype =", "type": "assigned_variable", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "vector": [14, 2, 0.1791, 0.005, 2, 0.67, 1.0, 781, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._contenttype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "label": "get", "type": "function", "loc": [38, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "vector": [2, 1, 0.1965, 0.0199, 1, 0.75, 1.0, 607, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles HTTP GET request.\"\"\"\n self.response.headers['Content-Type'] = self._contenttype\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "vector": [8, 2, 0.194, 0.005, 2, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L40_C4", "label": "assign", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "vector": [14, 2, 0.199, 0.005, 2, 0.19, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = self._contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L41_C4", "label": "write()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "vector": [8, 2, 0.204, 0.005, 2, 0.19, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "label": "ProfileHandler", "type": "class", "loc": [43, 58], "level": 0, "parent": null, "vector": [3, 0, 0.2512, 0.0796, 0, 0.66, 0.5714, 173, 0, 2, 0, 0, 256, 0, 6], "semantic": {"name": "ProfileHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ProfileHandler(webapp.RequestHandler):\n \"\"\"Handler to forward a request ot a handler of a robot.\"\"\"\n\n def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L44_C2", "label": "expression", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "vector": [8, 1, 0.2189, 0.005, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler to forward a request ot a handler of a robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "label": "__init__", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "vector": [2, 1, 0.2363, 0.0199, 1, 0.27, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "contenttype"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, contenttype):\n \"\"\"Initializes this handler with a specific robot.\"\"\"\n self._method = method\n self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "vector": [8, 2, 0.2338, 0.005, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this handler with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L48_C4", "label": "self._method =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "vector": [14, 2, 0.2388, 0.005, 2, 0.0, 0.5, 910, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L49_C4", "label": "self._contenttype =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "vector": [14, 2, 0.2438, 0.005, 2, 0.0, 1.0, 781, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._contenttype", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._contenttype = contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "label": "get", "type": "function", "loc": [51, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "vector": [2, 1, 0.2711, 0.0398, 1, 0.27, 1.0, 607, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles HTTP GET request.\"\"\"\n self.response.headers['Content-Type'] = self._contenttype\n # Respond with proxied profile if name specified\n if self.request.get('name'):\n self.response.out.write(self._method(self.request.get('name')))\n else:\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L52_C4", "label": "expression", "type": "expression", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "vector": [8, 2, 0.2587, 0.005, 2, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP GET request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L53_C4", "label": "assign", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "vector": [14, 2, 0.2637, 0.005, 2, 0.83, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = self._contenttype"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4", "label": "if", "type": "if", "loc": [55, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "vector": [4, 2, 0.2811, 0.0199, 2, 0.83, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request.get('name'):\n self.response.out.write(self._method(self.request.get('name')))\n else:\n self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L56_C6", "label": "write()", "type": "expression", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4", "vector": [8, 3, 0.2786, 0.005, 3, 0.41, 0.0, 837, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method(self.request.get('name')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L58_C6", "label": "write()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4", "vector": [8, 3, 0.2886, 0.005, 3, 0.41, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(self._method())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "label": "RobotEventHandler", "type": "class", "loc": [60, 105], "level": 0, "parent": null, "vector": [3, 0, 0.4104, 0.2289, 0, 0.66, 0.6429, 528, 0, 3, 0, 0, 256, 0, 8], "semantic": {"name": "RobotEventHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RobotEventHandler(webapp.RequestHandler):\n \"\"\"Handler for the dispatching of events to various handlers to a robot.\n\n This handler only responds to post events with a JSON post body. Its primary\n task is to separate out the context data from the events in the post body\n and dispatch all events in order. Once all events have been dispatched\n it serializes the context data and its associated operations as a response.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L61_C2", "label": "expression", "type": "expression", "loc": [61, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "vector": [8, 1, 0.3184, 0.0348, 1, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler for the dispatching of events to various handlers to a robot.\n\n This handler only responds to post events with a JSON post body. Its primary\n task is to separate out the context data from the events in the post body\n and dispatch all events in order. Once all events have been dispatched\n it serializes the context data and its associated operations as a response.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2", "label": "__init__", "type": "function", "loc": [69, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "vector": [2, 1, 0.3483, 0.0149, 1, 0.83, 0.3333, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "robot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L70_C4", "label": "expression", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2", "vector": [8, 2, 0.3483, 0.005, 2, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes self with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L71_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2", "vector": [14, 2, 0.3532, 0.005, 2, 0.14, 1.0, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "label": "get", "type": "function", "loc": [73, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "vector": [2, 1, 0.3856, 0.0498, 1, 0.83, 0.6667, 607, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles the get event for debugging.\n\n This is useful for debugging but since event bundles tend to be\n rather big it often won't fit for more complex requests.\n \"\"\"\n ops = self.request.get('events')\n if ops:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L74_C4", "label": "expression", "type": "expression", "loc": [74, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "vector": [8, 2, 0.3781, 0.0249, 2, 0.01, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles the get event for debugging.\n\n This is useful for debugging but since event bundles tend to be\n rather big it often won't fit for more complex requests.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L79_C4", "label": "ops = get()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "vector": [14, 2, 0.393, 0.005, 2, 0.01, 0.5, 212, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "ops", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " ops = self.request.get('events')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4", "label": "if", "type": "if", "loc": [80, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "vector": [4, 2, 0.403, 0.0149, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ops:\n self.request.body = events\n self.post()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L81_C6", "label": "self.request.body =", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4", "vector": [14, 3, 0.403, 0.005, 3, 0.01, 0.0, 399, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.request.body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.request.body = events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L82_C6", "label": "post()", "type": "expression", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4", "vector": [8, 3, 0.408, 0.005, 3, 0.01, 1.0, 304, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "post", "arg_names": [], "import_names": [], "rhs_call_name": "post", "annotation": ""}, "snippet": " self.post()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "label": "post", "type": "function", "loc": [84, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "vector": [2, 1, 0.4701, 0.1095, 1, 0.83, 1.0, 304, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "post", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def post(self):\n \"\"\"Handles HTTP POST requests.\"\"\"\n json_body = self.request.body\n if not json_body:\n # TODO(davidbyttow): Log error?\n return\n\n # Redirect stdout to stderr while executing handlers. This way, any stray"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L85_C4", "label": "expression", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [8, 2, 0.4229, 0.005, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles HTTP POST requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L86_C4", "label": "json_body =", "type": "assigned_variable", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.4279, 0.005, 2, 0.91, 0.1, 958, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json_body = self.request.body"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L87_C4", "label": "if", "type": "if", "loc": [87, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [4, 2, 0.4378, 0.0149, 2, 0.91, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not json_body:\n # TODO(davidbyttow): Log error?\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L89_C6", "label": "return", "type": "return", "loc": [89, 89], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L87_C4", "vector": [13, 3, 0.4428, 0.005, 3, 0.88, 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_1138:Assign_L94_C4", "label": "saved_stdout =", "type": "assigned_variable", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.4677, 0.005, 2, 0.91, 0.3, 826, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "saved_stdout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " saved_stdout, sys.stdout = sys.stdout, sys.stderr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L96_C4", "label": "json_body = unicode()", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.4776, 0.005, 2, 0.91, 0.4, 958, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "json_body", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " json_body = unicode(json_body, 'utf8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L97_C4", "label": "info()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [8, 2, 0.4826, 0.005, 2, 0.91, 0.5, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('Incoming: %s', json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L98_C4", "label": "json_response = process_events()", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.4876, 0.005, 2, 0.91, 0.6, 870, 3, 1, 0, 0, 196, 10, 1], "semantic": {"name": "json_response", "arg_names": [], "import_names": [], "rhs_call_name": "process_events", "annotation": ""}, "snippet": " json_response = self._robot.process_events(json_body)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L99_C4", "label": "info()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [8, 2, 0.4925, 0.005, 2, 0.91, 0.7, 730, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('Outgoing: %s', json_response)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L101_C4", "label": "sys.stdout =", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.5025, 0.005, 2, 0.91, 0.8, 260, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "sys.stdout", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sys.stdout = saved_stdout"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L104_C4", "label": "assign", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [14, 2, 0.5174, 0.005, 2, 0.91, 0.9, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.response.headers['Content-Type'] = 'application/json; charset=utf-8'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L105_C4", "label": "write()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "vector": [8, 2, 0.5224, 0.005, 2, 0.91, 1.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(json_response.encode('utf-8'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L108_C0", "label": "operation_error_handler", "type": "function", "loc": [108, 112], "level": 0, "parent": null, "vector": [2, 0, 0.5473, 0.0249, 0, 0.66, 0.7143, 332, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "operation_error_handler", "arg_names": ["event", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def operation_error_handler(event, wavelet):\n \"\"\"Default operation error handler, logging what went wrong.\"\"\"\n if isinstance(event, events.OperationError):\n logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L108_C0", "vector": [8, 1, 0.5423, 0.005, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Default operation error handler, logging what went wrong.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L110_C2", "label": "if", "type": "if", "loc": [110, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L108_C0", "vector": [4, 1, 0.5522, 0.0149, 1, 0.81, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(event, events.OperationError):\n logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L111_C4", "label": "error()", "type": "expression", "loc": [111, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L110_C2", "vector": [8, 2, 0.5547, 0.01, 2, 0.62, 0.0, 771, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " logging.error('Previously operation failed: id=%s, message: %s',\n event.operation_id, event.error_message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L115_C0", "label": "appengine_post", "type": "function", "loc": [115, 122], "level": 0, "parent": null, "vector": [2, 0, 0.5896, 0.0398, 0, 0.66, 0.7857, 418, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "appengine_post", "arg_names": ["url", "data", "headers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def appengine_post(url, data, headers):\n result = urlfetch.fetch(\n method='POST',\n url=url,\n payload=data,\n headers=headers,\n deadline=10)\n return result.status_code, result.content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L116_C2", "label": "result = fetch()", "type": "assigned_variable", "loc": [116, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L115_C0", "vector": [14, 1, 0.5896, 0.0299, 1, 0.2, 0.0, 51, 3, 5, 0, 0, 587, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " result = urlfetch.fetch(\n method='POST',\n url=url,\n payload=data,\n headers=headers,\n deadline=10)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L122_C2", "label": "return", "type": "return", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L115_C0", "vector": [13, 1, 0.607, 0.005, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return result.status_code, result.content"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "label": "RobotVerifyTokenHandler", "type": "class", "loc": [125, 144], "level": 0, "parent": null, "vector": [3, 0, 0.6692, 0.0995, 0, 0.66, 0.8571, 703, 0, 2, 0, 0, 256, 0, 8], "semantic": {"name": "RobotVerifyTokenHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RobotVerifyTokenHandler(webapp.RequestHandler):\n \"\"\"Handler for the token_verify request.\"\"\"\n\n def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot\n\n def get(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L126_C2", "label": "expression", "type": "expression", "loc": [126, 126], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "vector": [8, 1, 0.6269, 0.005, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handler for the token_verify request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2", "label": "__init__", "type": "function", "loc": [128, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "vector": [2, 1, 0.6418, 0.0149, 1, 0.44, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "robot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, robot):\n \"\"\"Initializes self with a specific robot.\"\"\"\n self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L129_C4", "label": "expression", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2", "vector": [8, 2, 0.6418, 0.005, 2, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes self with a specific robot.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L130_C4", "label": "self._robot =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2", "vector": [14, 2, 0.6468, 0.005, 2, 0.73, 1.0, 972, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._robot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._robot = robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "label": "get", "type": "function", "loc": [132, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "vector": [2, 1, 0.6866, 0.0647, 1, 0.44, 1.0, 607, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n \"\"\"Handles the get event for debugging. Ops usually too long.\"\"\"\n token, st = self._robot.get_verification_token_info()\n logging.info('token=%s' % token)\n if token is None:\n self.error(404)\n self.response.out.write('No token set')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L133_C4", "label": "expression", "type": "expression", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [8, 2, 0.6617, 0.005, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Handles the get event for debugging. Ops usually too long.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L134_C4", "label": "token, st = get_verification_token_info()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [14, 2, 0.6667, 0.005, 2, 0.46, 0.2, 520, 3, 0, 0, 0, 510, 10, 1], "semantic": {"name": "token, st", "arg_names": [], "import_names": [], "rhs_call_name": "get_verification_token_info", "annotation": ""}, "snippet": " token, st = self._robot.get_verification_token_info()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L135_C4", "label": "info()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [8, 2, 0.6716, 0.005, 2, 0.46, 0.4, 730, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": " logging.info('token=%s' % token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "label": "if", "type": "if", "loc": [136, 139], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [4, 2, 0.6841, 0.0199, 2, 0.46, 0.6, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token is None:\n self.error(404)\n self.response.out.write('No token set')\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L137_C6", "label": "error()", "type": "expression", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "vector": [8, 3, 0.6816, 0.005, 3, 0.69, 0.0, 771, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "error", "arg_names": [], "import_names": [], "rhs_call_name": "error", "annotation": ""}, "snippet": " self.error(404)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L138_C6", "label": "write()", "type": "expression", "loc": [138, 138], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "vector": [8, 3, 0.6866, 0.005, 3, 0.69, 0.5, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write('No token set')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L139_C6", "label": "return", "type": "return", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "vector": [13, 3, 0.6915, 0.005, 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_1138:If_L140_C4", "label": "if", "type": "if", "loc": [140, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [4, 2, 0.704, 0.0199, 2, 0.46, 0.8, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not st is None:\n if self.request.get('st') != st:\n self.response.out.write('Invalid st value passed %s != %s' % (st, self.request.get('st')))\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6", "label": "if", "type": "if", "loc": [141, 143], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L140_C4", "vector": [4, 3, 0.7065, 0.0149, 3, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.request.get('st') != st:\n self.response.out.write('Invalid st value passed %s != %s' % (st, self.request.get('st')))\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L142_C8", "label": "write()", "type": "expression", "loc": [142, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6", "vector": [8, 4, 0.7065, 0.005, 4, 0.6, 0.0, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write('Invalid st value passed %s != %s' % (st, self.request.get('st')))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L143_C8", "label": "return", "type": "return", "loc": [143, 143], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6", "vector": [13, 4, 0.7114, 0.005, 4, 0.6, 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_1138:Expr_L144_C4", "label": "write()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "vector": [8, 2, 0.7164, 0.005, 2, 0.46, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " self.response.out.write(token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "label": "create_robot_webapp", "type": "function", "loc": [147, 164], "level": 0, "parent": null, "vector": [2, 0, 0.7736, 0.0896, 0, 0.66, 0.9286, 128, 0, 3, 1, 0, 0, 0, 5], "semantic": {"name": "create_robot_webapp", "arg_names": ["robot", "debug", "extra_handlers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def create_robot_webapp(robot, debug=False, extra_handlers=None):\n \"\"\"Returns an instance of webapp.WSGIApplication with robot handlers.\"\"\"\n if not extra_handlers:\n extra_handlers = []\n return webapp.WSGIApplication([('.*/_wave/capabilities.xml',\n lambda: CapabilitiesHandler(\n robot.capabilities_xml,\n 'application/xml')),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L148_C2", "label": "expression", "type": "expression", "loc": [148, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "vector": [8, 1, 0.7363, 0.005, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns an instance of webapp.WSGIApplication with robot handlers.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L149_C2", "label": "if", "type": "if", "loc": [149, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "vector": [4, 1, 0.7438, 0.01, 1, 0.65, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not extra_handlers:\n extra_handlers = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L150_C4", "label": "extra_handlers =", "type": "assigned_variable", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L149_C2", "vector": [14, 2, 0.7463, 0.005, 2, 0.1, 0.0, 379, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "extra_handlers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " extra_handlers = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L151_C2", "label": "return", "type": "return", "loc": [151, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "vector": [13, 1, 0.7836, 0.0697, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return webapp.WSGIApplication([('.*/_wave/capabilities.xml',\n lambda: CapabilitiesHandler(\n robot.capabilities_xml,\n 'application/xml')),\n ('.*/_wave/robot/profile',\n lambda: ProfileHandler(\n robot.profile_json,\n 'application/json')),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "label": "run", "type": "function", "loc": [167, 201], "level": 0, "parent": null, "vector": [2, 0, 0.9154, 0.1741, 0, 0.66, 1.0, 679, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "run", "arg_names": ["robot", "debug", "log_errors", "extra_handlers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run(robot, debug=False, log_errors=True, extra_handlers=None):\n \"\"\"Sets up the webapp handlers for this robot and starts listening.\n\n A robot is typically setup in the following steps:\n 1. Instantiate and define robot.\n 2. Register various handlers that it is interested in.\n 3. Call Run, which will setup the handlers for the app.\n For example:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L168_C2", "label": "expression", "type": "expression", "loc": [168, 193], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "vector": [8, 1, 0.898, 0.1294, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets up the webapp handlers for this robot and starts listening.\n\n A robot is typically setup in the following steps:\n 1. Instantiate and define robot.\n 2. Register various handlers that it is interested in.\n 3. Call Run, which will setup the handlers for the app.\n For example:\n robot = Robot('Terminator',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L197_C2", "label": "if", "type": "if", "loc": [197, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "vector": [4, 1, 0.9826, 0.01, 1, 0.59, 0.25, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if log_errors:\n robot.register_handler(events.OperationError, operation_error_handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L198_C4", "label": "register_handler()", "type": "expression", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L197_C2", "vector": [8, 2, 0.9851, 0.005, 2, 0.39, 0.0, 116, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "register_handler", "arg_names": [], "import_names": [], "rhs_call_name": "register_handler", "annotation": ""}, "snippet": " robot.register_handler(events.OperationError, operation_error_handler)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L199_C2", "label": "robot.http_post =", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "vector": [14, 1, 0.99, 0.005, 1, 0.59, 0.5, 986, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "robot.http_post", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " robot.http_post = appengine_post"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L200_C2", "label": "app = create_robot_webapp()", "type": "assigned_variable", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "vector": [14, 1, 0.995, 0.005, 1, 0.59, 0.75, 494, 3, 3, 0, 0, 128, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "create_robot_webapp", "annotation": ""}, "snippet": " app = create_robot_webapp(robot, debug, extra_handlers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L201_C2", "label": "run_wsgi_app()", "type": "expression", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "vector": [8, 1, 1.0, 0.005, 1, 0.59, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " run_wsgi_app(app)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L55_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L87_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L89_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L84_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L110_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L110_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L115_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L126_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L128_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:ClassDef_L125_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L137_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L138_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L139_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L140_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L142_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L141_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L143_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L148_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L149_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L149_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L147_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Return_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L197_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:If_L197_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Assign_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1138:FunctionDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1138:Expr_L201_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the blip module."""
import unittest
import blip
import element
import ops
import simplejson
TEST_BLIP_DATA = {
'childBlipIds': [],
'content': '\nhello world!\nanother line',
'contributors': ['robot@test.com', 'user@test.com'],
'creator': 'user@test.com',
'lastModifiedTime': 1000,
'parentBlipId': None,
'annotations': [{'range': {'start': 2, 'end': 3},
'name': 'key', 'value': 'val'}],
'waveId': 'test.com!w+g3h3im',
'waveletId': 'test.com!root+conv',
'elements':{'14':{'type':'GADGET','properties':{'url':'http://a/b.xml'}}},
}
CHILD_BLIP_ID = 'b+42'
ROOT_BLIP_ID = 'b+43'
class TestBlip(unittest.TestCase):
"""Tests the primary data structures for the wave model."""
def assertBlipStartswith(self, expected, totest):
actual = totest.text[:len(expected)]
self.assertEquals(expected, actual)
def new_blip(self, **args):
"""Create a blip for testing."""
data = TEST_BLIP_DATA.copy()
data.update(args)
res = blip.Blip(data, self.all_blips, self.operation_queue)
self.all_blips[res.blip_id] = res
return res
def setUp(self):
self.all_blips = {}
self.operation_queue = ops.OperationQueue()
def testBlipProperties(self):
root = self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID])
child = self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
self.assertEquals(ROOT_BLIP_ID, root.blip_id)
self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)
self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)
self.assertEquals(TEST_BLIP_DATA['creator'], root.creator)
self.assertEquals(TEST_BLIP_DATA['content'], root.text)
self.assertEquals(TEST_BLIP_DATA['lastModifiedTime'],
root.last_modified_time)
self.assertEquals(TEST_BLIP_DATA['parentBlipId'], root.parent_blip_id)
self.assertEquals(TEST_BLIP_DATA['waveId'], root.wave_id)
self.assertEquals(TEST_BLIP_DATA['waveletId'], root.wavelet_id)
self.assertEquals(TEST_BLIP_DATA['content'][3], root[3])
self.assertEquals(element.Gadget.class_type, root[14].type)
self.assertEquals('http://a/b.xml', root[14].url)
self.assertEquals('a', root.text[14])
self.assertEquals(len(TEST_BLIP_DATA['content']), len(root))
self.assertTrue(root.is_root())
self.assertFalse(child.is_root())
self.assertEquals(root, child.parent_blip)
def testBlipSerialize(self):
root = self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID])
serialized = root.serialize()
unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)
self.assertEquals(root.blip_id, unserialized.blip_id)
self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)
self.assertEquals(root.contributors, unserialized.contributors)
self.assertEquals(root.creator, unserialized.creator)
self.assertEquals(root.text, unserialized.text)
self.assertEquals(root.last_modified_time, unserialized.last_modified_time)
self.assertEquals(root.parent_blip_id, unserialized.parent_blip_id)
self.assertEquals(root.wave_id, unserialized.wave_id)
self.assertEquals(root.wavelet_id, unserialized.wavelet_id)
self.assertTrue(unserialized.is_root())
def testDocumentOperations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
newlines = [x for x in blip.find('\n')]
self.assertEquals(2, len(newlines))
blip.first('world').replace('jupiter')
bits = blip.text.split('\n')
self.assertEquals(3, len(bits))
self.assertEquals('hello jupiter!', bits[1])
blip.range(2, 5).delete()
self.assertBlipStartswith('\nho jupiter', blip)
blip.first('ho').insert_after('la')
self.assertBlipStartswith('\nhola jupiter', blip)
blip.at(3).insert(' ')
self.assertBlipStartswith('\nho la jupiter', blip)
def testElementHandling(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
url = 'http://www.test.com/image.png'
org_len = len(blip)
blip.append(element.Image(url=url))
elems = [elem for elem in blip.find(element.Image, url=url)]
self.assertEquals(1, len(elems))
elem = elems[0]
self.assertTrue(isinstance(elem, element.Image))
blip.at(1).insert('twelve chars')
self.assertTrue(blip.text.startswith('\ntwelve charshello'))
elem = blip[org_len + 12].value()
self.assertTrue(isinstance(elem, element.Image))
blip.first('twelve ').delete()
self.assertTrue(blip.text.startswith('\nchars'))
elem = blip[org_len + 12 - len('twelve ')].value()
self.assertTrue(isinstance(elem, element.Image))
blip.first('chars').replace(element.Image(url=url))
elems = [elem for elem in blip.find(element.Image, url=url)]
self.assertEquals(2, len(elems))
self.assertTrue(blip.text.startswith('\n hello'))
elem = blip[1].value()
self.assertTrue(isinstance(elem, element.Image))
def testAnnotationHandling(self):
key = 'style/fontWeight'
def get_bold():
for an in blip.annotations[key]:
if an.value == 'bold':
return an
return None
json = ('[{"range":{"start":3,"end":6},"name":"%s","value":"bold"}]'
% key)
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json))
self.assertEquals(1, len(blip.annotations))
self.assertNotEqual(None, get_bold().value)
self.assertTrue(key in blip.annotations)
# extend the bold annotation by adding:
blip.range(5, 8).annotate(key, 'bold')
self.assertEquals(1, len(blip.annotations))
self.assertEquals(8, get_bold().end)
# clip by adding a same keyed:
blip[4:12].annotate(key, 'italic')
self.assertEquals(2, len(blip.annotations[key]))
self.assertEquals(4, get_bold().end)
# now split the italic one:
blip.range(6, 7).clear_annotation(key)
self.assertEquals(3, len(blip.annotations[key]))
# test names and iteration
self.assertEquals(1, len(blip.annotations.names()))
self.assertEquals(3, len([x for x in blip.annotations]))
blip[3: 5].annotate('foo', 'bar')
self.assertEquals(2, len(blip.annotations.names()))
self.assertEquals(4, len([x for x in blip.annotations]))
blip[3: 5].clear_annotation('foo')
# clear the whole thing
blip.all().clear_annotation(key)
# getting to the key should now throw an exception
self.assertRaises(KeyError, blip.annotations.__getitem__, key)
def testBlipOperations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEquals(1, len(self.all_blips))
otherblip = blip.reply()
otherblip.append('hello world')
self.assertEquals('hello world', otherblip.text)
self.assertEquals(blip.blip_id, otherblip.parent_blip_id)
self.assertEquals(2, len(self.all_blips))
inline = blip.insert_inline_blip(3)
self.assertEquals(blip.blip_id, inline.parent_blip_id)
self.assertEquals(3, len(self.all_blips))
def testInsertInlineBlipCantInsertAtTheBeginning(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEquals(1, len(self.all_blips))
self.assertRaises(IndexError, blip.insert_inline_blip, 0)
self.assertEquals(1, len(self.all_blips))
def testDocumentModify(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('a text with text and then some text')
blip[7].insert('text ')
blip.all('text').replace('thing')
self.assertEquals('a thing thing with thing and then some thing',
blip.text)
def testIteration(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('aaa 012 aaa 345 aaa 322')
count = 0
prev = -1
for start, end in blip.all('aaa'):
count += 1
self.assertTrue(prev < start)
prev = start
self.assertEquals(3, count)
def testBlipRefValue(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
content = blip.text
content = content[:4] + content[5:]
del blip[4]
self.assertEquals(content, blip.text)
content = content[:2] + content[3:]
del blip[2:3]
self.assertEquals(content, blip.text)
blip[2:3] = 'bike'
content = content[:2] + 'bike' + content[3:]
self.assertEquals(content, blip.text)
url = 'http://www.test.com/image.png'
blip.append(element.Image(url=url))
self.assertEqual(url, blip.first(element.Image).url)
url2 = 'http://www.test.com/another.png'
blip[-1].update_element({'url': url2})
self.assertEqual(url2, blip.first(element.Image).url)
self.assertTrue(blip[3:5] == blip.text[3:5])
blip.append('geheim')
self.assertTrue(blip.first('geheim'))
self.assertFalse(blip.first(element.Button))
blip.append(element.Button(name='test1', value='Click'))
button = blip.first(element.Button)
button.update_element({'name': 'test2'})
self.assertEqual('test2', button.name)
def testReplace(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
blip.all().replace('\nxxxx')
blip.all('yyy').replace('zzz')
self.assertEqual('\nxxxx', blip.text)
def testDeleteRangeThatSpansAcrossAnnotationEndPoint(self):
json = ('[{"range":{"start":1,"end":3},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).delete()
self.assertEqual('\nF bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(2, blip.annotations['style'][0].end)
def testInsertBeforeAnnotationStartPoint(self):
json = ('[{"range":{"start":4,"end":9},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.at(4).insert('d and')
self.assertEqual('\nFood and bar.', blip.text)
self.assertEqual(9, blip.annotations['style'][0].start)
self.assertEqual(14, blip.annotations['style'][0].end)
def testDeleteRangeInsideAnnotation(self):
json = ('[{"range":{"start":1,"end":5},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).delete()
self.assertEqual('\nF bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(3, blip.annotations['style'][0].end)
def testReplaceInsideAnnotation(self):
json = ('[{"range":{"start":1,"end":5},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 4).replace('ooo')
self.assertEqual('\nFooo bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(6, blip.annotations['style'][0].end)
blip.range(2, 5).replace('o')
self.assertEqual('\nFo bar.', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(4, blip.annotations['style'][0].end)
def testReplaceSpanAnnotation(self):
json = ('[{"range":{"start":1,"end":4},"name":"style","value":"bold"}]')
blip = self.new_blip(blipId=ROOT_BLIP_ID,
annotations=simplejson.loads(json),
content='\nFoo bar.')
blip.range(2, 9).replace('')
self.assertEqual('\nF', blip.text)
self.assertEqual(1, blip.annotations['style'][0].start)
self.assertEqual(2, blip.annotations['style'][0].end)
def testSearchWithNoMatchShouldNotGenerateOperation(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID)
self.assertEqual(-1, blip.text.find(':('))
self.assertEqual(0, len(self.operation_queue))
blip.all(':(').replace(':)')
self.assertEqual(0, len(self.operation_queue))
def testBlipsRemoveWithId(self):
blip_dict = {
ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID]),
CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
}
blips = blip.Blips(blip_dict)
blips._remove_with_id(CHILD_BLIP_ID)
self.assertEqual(1, len(blips))
self.assertEqual(0, len(blips[ROOT_BLIP_ID].child_blip_ids))
def testAppendMarkup(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\nFoo bar.')
markup = '<p><span>markup<span> content</p>'
blip.append_markup(markup)
self.assertEqual(1, len(self.operation_queue))
self.assertEqual('\nFoo bar.\nmarkup content', blip.text)
def testBundledAnnotations(self):
blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\nFoo bar.')
blip.append('not bold')
blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])
self.assertEqual(2, len(blip.annotations))
self.assertEqual('bold', blip.annotations['style/fontWeight'][0].value)
def testInlineBlipOffset(self):
offset = 14
self.new_blip(blipId=ROOT_BLIP_ID,
childBlipIds=[CHILD_BLIP_ID],
elements={str(offset):
{'type': element.Element.INLINE_BLIP_TYPE,
'properties': {'id': CHILD_BLIP_ID}}})
child = self.new_blip(blipId=CHILD_BLIP_ID,
parentBlipId=ROOT_BLIP_ID)
self.assertEqual(offset, child.inline_blip_offset)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1139 | 253 | 374 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0027, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the blip module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0535, 0.0027, 0, 0.66, 0.1, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Import_L22_C0", "label": "blip import blip", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0588, 0.0027, 0, 0.66, 0.2, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0615, 0.0027, 0, 0.66, 0.3, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Import_L24_C0", "label": "ops import ops", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0642, 0.0027, 0, 0.66, 0.4, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Import_L25_C0", "label": "simplejson import simplejson", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0668, 0.0027, 0, 0.66, 0.5, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L27_C0", "label": "TEST_BLIP_DATA =", "type": "assigned_variable", "loc": [27, 39], "level": 0, "parent": null, "vector": [14, 0, 0.0882, 0.0348, 0, 0.66, 0.6, 853, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_BLIP_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_BLIP_DATA = {\n 'childBlipIds': [],\n 'content': '\\nhello world!\\nanother line',\n 'contributors': ['robot@test.com', 'user@test.com'],\n 'creator': 'user@test.com',\n 'lastModifiedTime': 1000,\n 'parentBlipId': None,\n 'annotations': [{'range': {'start': 2, 'end': 3},"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L41_C0", "label": "CHILD_BLIP_ID =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.1096, 0.0027, 0, 0.66, 0.7, 434, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CHILD_BLIP_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CHILD_BLIP_ID = 'b+42'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L42_C0", "label": "ROOT_BLIP_ID =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.1123, 0.0027, 0, 0.66, 0.8, 693, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_BLIP_ID", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_BLIP_ID = 'b+43'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "label": "TestBlip", "type": "class", "loc": [45, 371], "level": 0, "parent": null, "vector": [3, 0, 0.5561, 0.8743, 0, 0.66, 0.9, 841, 0, 25, 0, 0, 878, 0, 99], "semantic": {"name": "TestBlip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestBlip(unittest.TestCase):\n \"\"\"Tests the primary data structures for the wave model.\"\"\"\n\n def assertBlipStartswith(self, expected, totest):\n actual = totest.text[:len(expected)]\n self.assertEquals(expected, actual)\n\n def new_blip(self, **args):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L46_C2", "label": "expression", "type": "expression", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [8, 1, 0.123, 0.0027, 1, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests the primary data structures for the wave model.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2", "label": "assertBlipStartswith", "type": "function", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.131, 0.008, 1, 0.43, 0.0417, 573, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "assertBlipStartswith", "arg_names": ["self", "expected", "totest"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def assertBlipStartswith(self, expected, totest):\n actual = totest.text[:len(expected)]\n self.assertEquals(expected, actual)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L49_C4", "label": "actual =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2", "vector": [14, 2, 0.131, 0.0027, 2, 0.23, 0.0, 331, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "actual", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " actual = totest.text[:len(expected)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L50_C4", "label": "assertEquals()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2", "vector": [8, 2, 0.1337, 0.0027, 2, 0.23, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(expected, actual)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "label": "new_blip", "type": "function", "loc": [52, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.1471, 0.0187, 1, 0.43, 0.0833, 893, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "new_blip", "arg_names": ["self", "args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_blip(self, **args):\n \"\"\"Create a blip for testing.\"\"\"\n data = TEST_BLIP_DATA.copy()\n data.update(args)\n res = blip.Blip(data, self.all_blips, self.operation_queue)\n self.all_blips[res.blip_id] = res\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [8, 2, 0.1417, 0.0027, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Create a blip for testing.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L54_C4", "label": "data = copy()", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [14, 2, 0.1444, 0.0027, 2, 0.15, 0.2, 929, 3, 0, 0, 0, 739, 10, 1], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " data = TEST_BLIP_DATA.copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L55_C4", "label": "update()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [8, 2, 0.1471, 0.0027, 2, 0.15, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " data.update(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L56_C4", "label": "res = Blip()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [14, 2, 0.1497, 0.0027, 2, 0.15, 0.6, 413, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " res = blip.Blip(data, self.all_blips, self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L57_C4", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [14, 2, 0.1524, 0.0027, 2, 0.15, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips[res.blip_id] = res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "vector": [13, 2, 0.1551, 0.0027, 2, 0.15, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2", "label": "setUp", "type": "function", "loc": [60, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.1631, 0.008, 1, 0.43, 0.125, 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.all_blips = {}\n self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L61_C4", "label": "self.all_blips =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2", "vector": [14, 2, 0.1631, 0.0027, 2, 0.62, 0.0, 606, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.all_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L62_C4", "label": "self.operation_queue = OperationQueue()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2", "vector": [14, 2, 0.1658, 0.0027, 2, 0.62, 1.0, 118, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "self.operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "label": "testBlipProperties", "type": "function", "loc": [64, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.2005, 0.0615, 1, 0.43, 0.1667, 83, 0, 1, 0, 0, 0, 0, 25], "semantic": {"name": "testBlipProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipProperties(self):\n root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])\n child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n self.assertEquals(ROOT_BLIP_ID, root.blip_id)\n self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)\n self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L65_C4", "label": "root = new_blip()", "type": "assigned_variable", "loc": [65, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [14, 2, 0.1751, 0.0053, 2, 0.15, 0.0, 696, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L67_C4", "label": "child = new_blip()", "type": "assigned_variable", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [14, 2, 0.1805, 0.0053, 2, 0.15, 0.0556, 967, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L69_C4", "label": "assertEquals()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1845, 0.0027, 2, 0.15, 0.1111, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(ROOT_BLIP_ID, root.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L70_C4", "label": "assertEquals()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1872, 0.0027, 2, 0.15, 0.1667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(set([CHILD_BLIP_ID]), root.child_blip_ids)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L71_C4", "label": "assertEquals()", "type": "expression", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1898, 0.0027, 2, 0.15, 0.2222, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(set(TEST_BLIP_DATA['contributors']), root.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L72_C4", "label": "assertEquals()", "type": "expression", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1925, 0.0027, 2, 0.15, 0.2778, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['creator'], root.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L73_C4", "label": "assertEquals()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1952, 0.0027, 2, 0.15, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['content'], root.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L74_C4", "label": "assertEquals()", "type": "expression", "loc": [74, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.1992, 0.0053, 2, 0.15, 0.3889, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['lastModifiedTime'],\n root.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L76_C4", "label": "assertEquals()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2032, 0.0027, 2, 0.15, 0.4444, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['parentBlipId'], root.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L77_C4", "label": "assertEquals()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2059, 0.0027, 2, 0.15, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['waveId'], root.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2086, 0.0027, 2, 0.15, 0.5556, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['waveletId'], root.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L79_C4", "label": "assertEquals()", "type": "expression", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2112, 0.0027, 2, 0.15, 0.6111, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_BLIP_DATA['content'][3], root[3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L80_C4", "label": "assertEquals()", "type": "expression", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2139, 0.0027, 2, 0.15, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(element.Gadget.class_type, root[14].type)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L81_C4", "label": "assertEquals()", "type": "expression", "loc": [81, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2166, 0.0027, 2, 0.15, 0.7222, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('http://a/b.xml', root[14].url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L82_C4", "label": "assertEquals()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2193, 0.0027, 2, 0.15, 0.7778, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('a', root.text[14])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2219, 0.0027, 2, 0.15, 0.8333, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(TEST_BLIP_DATA['content']), len(root))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L84_C4", "label": "assertTrue()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2246, 0.0027, 2, 0.15, 0.8889, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(root.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L85_C4", "label": "assertFalse()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2273, 0.0027, 2, 0.15, 0.9444, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(child.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "vector": [8, 2, 0.2299, 0.0027, 2, 0.15, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root, child.parent_blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "label": "testBlipSerialize", "type": "function", "loc": [88, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.254, 0.0401, 1, 0.43, 0.2083, 1, 0, 1, 0, 0, 0, 0, 14], "semantic": {"name": "testBlipSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipSerialize(self):\n root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])\n serialized = root.serialize()\n unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)\n self.assertEquals(root.blip_id, unserialized.blip_id)\n self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)\n self.assertEquals(root.contributors, unserialized.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L89_C4", "label": "root = new_blip()", "type": "assigned_variable", "loc": [89, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [14, 2, 0.2393, 0.0053, 2, 0.75, 0.0, 696, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "root", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " root = self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L91_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [14, 2, 0.2433, 0.0027, 2, 0.75, 0.0833, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = root.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L92_C4", "label": "unserialized = Blip()", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [14, 2, 0.246, 0.0027, 2, 0.75, 0.1667, 161, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "unserialized", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " unserialized = blip.Blip(serialized, self.all_blips, self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L93_C4", "label": "assertEquals()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2487, 0.0027, 2, 0.75, 0.25, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.blip_id, unserialized.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L94_C4", "label": "assertEquals()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2513, 0.0027, 2, 0.75, 0.3333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.child_blip_ids, unserialized.child_blip_ids)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.254, 0.0027, 2, 0.75, 0.4167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.contributors, unserialized.contributors)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L96_C4", "label": "assertEquals()", "type": "expression", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2567, 0.0027, 2, 0.75, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.creator, unserialized.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L97_C4", "label": "assertEquals()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2594, 0.0027, 2, 0.75, 0.5833, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.text, unserialized.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L98_C4", "label": "assertEquals()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.262, 0.0027, 2, 0.75, 0.6667, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.last_modified_time, unserialized.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L99_C4", "label": "assertEquals()", "type": "expression", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2647, 0.0027, 2, 0.75, 0.75, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.parent_blip_id, unserialized.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L100_C4", "label": "assertEquals()", "type": "expression", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2674, 0.0027, 2, 0.75, 0.8333, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.wave_id, unserialized.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L101_C4", "label": "assertEquals()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2701, 0.0027, 2, 0.75, 0.9167, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(root.wavelet_id, unserialized.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L102_C4", "label": "assertTrue()", "type": "expression", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "vector": [8, 2, 0.2727, 0.0027, 2, 0.75, 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(unserialized.is_root())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "label": "testDocumentOperations", "type": "function", "loc": [104, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.2968, 0.0401, 1, 0.43, 0.25, 764, 0, 1, 0, 0, 0, 0, 19], "semantic": {"name": "testDocumentOperations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDocumentOperations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n newlines = [x for x in blip.find('\\n')]\n self.assertEquals(2, len(newlines))\n blip.first('world').replace('jupiter')\n bits = blip.text.split('\\n')\n self.assertEquals(3, len(bits))\n self.assertEquals('hello jupiter!', bits[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L105_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [14, 2, 0.2807, 0.0027, 2, 0.22, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L106_C4", "label": "newlines =", "type": "assigned_variable", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [14, 2, 0.2834, 0.0027, 2, 0.22, 0.0833, 73, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "newlines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newlines = [x for x in blip.find('\\n')]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L107_C4", "label": "assertEquals()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.2861, 0.0027, 2, 0.22, 0.1667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(newlines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L108_C4", "label": "replace()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.2888, 0.0027, 2, 0.22, 0.25, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.first('world').replace('jupiter')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L109_C4", "label": "bits = split()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [14, 2, 0.2914, 0.0027, 2, 0.22, 0.3333, 593, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "bits", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " bits = blip.text.split('\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L110_C4", "label": "assertEquals()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.2941, 0.0027, 2, 0.22, 0.4167, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(bits))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L111_C4", "label": "assertEquals()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.2968, 0.0027, 2, 0.22, 0.5, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('hello jupiter!', bits[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L112_C4", "label": "delete()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.2995, 0.0027, 2, 0.22, 0.5833, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 5).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L113_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.3021, 0.0027, 2, 0.22, 0.6667, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nho jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L115_C4", "label": "insert_after()", "type": "expression", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.3075, 0.0027, 2, 0.22, 0.75, 441, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert_after", "arg_names": [], "import_names": [], "rhs_call_name": "insert_after", "annotation": ""}, "snippet": " blip.first('ho').insert_after('la')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L116_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.3102, 0.0027, 2, 0.22, 0.8333, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nhola jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L117_C4", "label": "insert()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.3128, 0.0027, 2, 0.22, 0.9167, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(3).insert(' ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L118_C4", "label": "assertBlipStartswith()", "type": "expression", "loc": [118, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "vector": [8, 2, 0.3155, 0.0027, 2, 0.22, 1.0, 573, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertBlipStartswith", "arg_names": [], "import_names": [], "rhs_call_name": "assertBlipStartswith", "annotation": ""}, "snippet": " self.assertBlipStartswith('\\nho la jupiter', blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "label": "testElementHandling", "type": "function", "loc": [120, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.3583, 0.0775, 1, 0.43, 0.2917, 772, 0, 1, 0, 0, 0, 0, 35], "semantic": {"name": "testElementHandling", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testElementHandling(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n url = 'http://www.test.com/image.png'\n\n org_len = len(blip)\n blip.append(element.Image(url=url))\n\n elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L121_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [121, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3235, 0.0027, 2, 0.6, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L122_C4", "label": "url =", "type": "assigned_variable", "loc": [122, 122], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3262, 0.0027, 2, 0.6, 0.0476, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.test.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L124_C4", "label": "org_len = len()", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3316, 0.0027, 2, 0.6, 0.0952, 784, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "org_len", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " org_len = len(blip)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L125_C4", "label": "append()", "type": "expression", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3342, 0.0027, 2, 0.6, 0.1429, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L127_C4", "label": "elems =", "type": "assigned_variable", "loc": [127, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3396, 0.0027, 2, 0.6, 0.1905, 280, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "elems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L128_C4", "label": "assertEquals()", "type": "expression", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3422, 0.0027, 2, 0.6, 0.2381, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(elems))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L129_C4", "label": "elem =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3449, 0.0027, 2, 0.6, 0.2857, 63, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elem = elems[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L130_C4", "label": "assertTrue()", "type": "expression", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3476, 0.0027, 2, 0.6, 0.3333, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L131_C4", "label": "insert()", "type": "expression", "loc": [131, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3503, 0.0027, 2, 0.6, 0.381, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(1).insert('twelve chars')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L132_C4", "label": "assertTrue()", "type": "expression", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3529, 0.0027, 2, 0.6, 0.4286, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\ntwelve charshello'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L134_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3583, 0.0027, 2, 0.6, 0.4762, 63, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[org_len + 12].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L135_C4", "label": "assertTrue()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.361, 0.0027, 2, 0.6, 0.5238, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L137_C4", "label": "delete()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3663, 0.0027, 2, 0.6, 0.5714, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.first('twelve ').delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L138_C4", "label": "assertTrue()", "type": "expression", "loc": [138, 138], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.369, 0.0027, 2, 0.6, 0.619, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\nchars'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L140_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.3743, 0.0027, 2, 0.6, 0.6667, 63, 3, 0, 0, 0, 441, 10, 2], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[org_len + 12 - len('twelve ')].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L141_C4", "label": "assertTrue()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.377, 0.0027, 2, 0.6, 0.7143, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L143_C4", "label": "replace()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3824, 0.0027, 2, 0.6, 0.7619, 293, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.first('chars').replace(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L144_C4", "label": "elems =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.385, 0.0027, 2, 0.6, 0.8095, 280, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "elems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elems = [elem for elem in blip.find(element.Image, url=url)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3877, 0.0027, 2, 0.6, 0.8571, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(elems))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L146_C4", "label": "assertTrue()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3904, 0.0027, 2, 0.6, 0.9048, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.text.startswith('\\n hello'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L147_C4", "label": "elem = value()", "type": "assigned_variable", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [14, 2, 0.393, 0.0027, 2, 0.6, 0.9524, 63, 3, 0, 0, 0, 441, 10, 1], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "value", "annotation": ""}, "snippet": " elem = blip[1].value()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L148_C4", "label": "assertTrue()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "vector": [8, 2, 0.3957, 0.0027, 2, 0.6, 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(isinstance(elem, element.Image))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "label": "testAnnotationHandling", "type": "function", "loc": [150, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.4572, 0.115, 1, 0.43, 0.3333, 403, 0, 1, 1, 0, 0, 0, 37], "semantic": {"name": "testAnnotationHandling", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAnnotationHandling(self):\n key = 'style/fontWeight'\n\n def get_bold():\n for an in blip.annotations[key]:\n if an.value == 'bold':\n return an\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L151_C4", "label": "key =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [14, 2, 0.4037, 0.0027, 2, 0.77, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'style/fontWeight'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4", "label": "get_bold", "type": "function", "loc": [153, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [2, 2, 0.4144, 0.0134, 2, 0.77, 0.0455, 163, 0, 0, 1, 0, 0, 0, 0], "semantic": {"name": "get_bold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_bold():\n for an in blip.annotations[key]:\n if an.value == 'bold':\n return an\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L154_C6", "label": "for an", "type": "for", "loc": [154, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4", "vector": [6, 3, 0.4144, 0.008, 3, 0.99, 0.0, 770, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "an", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for an in blip.annotations[key]:\n if an.value == 'bold':\n return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L155_C8", "label": "if", "type": "if", "loc": [155, 156], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L154_C6", "vector": [4, 4, 0.4158, 0.0053, 4, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if an.value == 'bold':\n return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L156_C10", "label": "return", "type": "return", "loc": [156, 156], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L155_C8", "vector": [13, 5, 0.4171, 0.0027, 5, 0.6, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return an"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L157_C6", "label": "return", "type": "return", "loc": [157, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4", "vector": [13, 3, 0.4198, 0.0027, 3, 0.99, 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_1139:Assign_L159_C4", "label": "json =", "type": "assigned_variable", "loc": [159, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [14, 2, 0.4265, 0.0053, 2, 0.77, 0.0909, 463, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":3,\"end\":6},\"name\":\"%s\",\"value\":\"bold\"}]'\n % key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L161_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [14, 2, 0.4318, 0.0053, 2, 0.77, 0.1364, 134, 3, 2, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L163_C4", "label": "assertEquals()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4358, 0.0027, 2, 0.77, 0.1818, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L164_C4", "label": "assertNotEqual()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4385, 0.0027, 2, 0.77, 0.2273, 120, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertNotEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertNotEqual", "annotation": ""}, "snippet": " self.assertNotEqual(None, get_bold().value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L165_C4", "label": "assertTrue()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4412, 0.0027, 2, 0.77, 0.2727, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(key in blip.annotations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L168_C4", "label": "annotate()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4492, 0.0027, 2, 0.77, 0.3182, 296, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip.range(5, 8).annotate(key, 'bold')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L169_C4", "label": "assertEquals()", "type": "expression", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4519, 0.0027, 2, 0.77, 0.3636, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L170_C4", "label": "assertEquals()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4545, 0.0027, 2, 0.77, 0.4091, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(8, get_bold().end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L173_C4", "label": "annotate()", "type": "expression", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4626, 0.0027, 2, 0.77, 0.4545, 296, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip[4:12].annotate(key, 'italic')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L174_C4", "label": "assertEquals()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4652, 0.0027, 2, 0.77, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(blip.annotations[key]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L175_C4", "label": "assertEquals()", "type": "expression", "loc": [175, 175], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4679, 0.0027, 2, 0.77, 0.5455, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(4, get_bold().end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L178_C4", "label": "clear_annotation()", "type": "expression", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4759, 0.0027, 2, 0.77, 0.5909, 359, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip.range(6, 7).clear_annotation(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L179_C4", "label": "assertEquals()", "type": "expression", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4786, 0.0027, 2, 0.77, 0.6364, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(blip.annotations[key]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L182_C4", "label": "assertEquals()", "type": "expression", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4866, 0.0027, 2, 0.77, 0.6818, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(blip.annotations.names()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L183_C4", "label": "assertEquals()", "type": "expression", "loc": [183, 183], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4893, 0.0027, 2, 0.77, 0.7273, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len([x for x in blip.annotations]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L184_C4", "label": "annotate()", "type": "expression", "loc": [184, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.492, 0.0027, 2, 0.77, 0.7727, 296, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "annotate", "arg_names": [], "import_names": [], "rhs_call_name": "annotate", "annotation": ""}, "snippet": " blip[3: 5].annotate('foo', 'bar')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L185_C4", "label": "assertEquals()", "type": "expression", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4947, 0.0027, 2, 0.77, 0.8182, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(blip.annotations.names()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L186_C4", "label": "assertEquals()", "type": "expression", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.4973, 0.0027, 2, 0.77, 0.8636, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(4, len([x for x in blip.annotations]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L187_C4", "label": "clear_annotation()", "type": "expression", "loc": [187, 187], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.5, 0.0027, 2, 0.77, 0.9091, 359, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip[3: 5].clear_annotation('foo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L190_C4", "label": "clear_annotation()", "type": "expression", "loc": [190, 190], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.508, 0.0027, 2, 0.77, 0.9545, 359, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "clear_annotation", "arg_names": [], "import_names": [], "rhs_call_name": "clear_annotation", "annotation": ""}, "snippet": " blip.all().clear_annotation(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L192_C4", "label": "assertRaises()", "type": "expression", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "vector": [8, 2, 0.5134, 0.0027, 2, 0.77, 1.0, 11, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertRaises", "arg_names": [], "import_names": [], "rhs_call_name": "assertRaises", "annotation": ""}, "snippet": " self.assertRaises(KeyError, blip.annotations.__getitem__, key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "label": "testBlipOperations", "type": "function", "loc": [194, 206], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.5348, 0.0348, 1, 0.43, 0.375, 837, 0, 1, 0, 0, 0, 0, 13], "semantic": {"name": "testBlipOperations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipOperations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEquals(1, len(self.all_blips))\n\n otherblip = blip.reply()\n otherblip.append('hello world')\n self.assertEquals('hello world', otherblip.text)\n self.assertEquals(blip.blip_id, otherblip.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L195_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [195, 195], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [14, 2, 0.5214, 0.0027, 2, 0.83, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L196_C4", "label": "assertEquals()", "type": "expression", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5241, 0.0027, 2, 0.83, 0.1111, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L198_C4", "label": "otherblip = reply()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [14, 2, 0.5294, 0.0027, 2, 0.83, 0.2222, 259, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "otherblip", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " otherblip = blip.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L199_C4", "label": "append()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5321, 0.0027, 2, 0.83, 0.3333, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " otherblip.append('hello world')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L200_C4", "label": "assertEquals()", "type": "expression", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5348, 0.0027, 2, 0.83, 0.4444, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('hello world', otherblip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L201_C4", "label": "assertEquals()", "type": "expression", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5374, 0.0027, 2, 0.83, 0.5556, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(blip.blip_id, otherblip.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L202_C4", "label": "assertEquals()", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5401, 0.0027, 2, 0.83, 0.6667, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L204_C4", "label": "inline = insert_inline_blip()", "type": "assigned_variable", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [14, 2, 0.5455, 0.0027, 2, 0.83, 0.7778, 7, 3, 1, 0, 0, 203, 10, 1], "semantic": {"name": "inline", "arg_names": [], "import_names": [], "rhs_call_name": "insert_inline_blip", "annotation": ""}, "snippet": " inline = blip.insert_inline_blip(3)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L205_C4", "label": "assertEquals()", "type": "expression", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5481, 0.0027, 2, 0.83, 0.8889, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(blip.blip_id, inline.parent_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L206_C4", "label": "assertEquals()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "vector": [8, 2, 0.5508, 0.0027, 2, 0.83, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "label": "testInsertInlineBlipCantInsertAtTheBeginning", "type": "function", "loc": [208, 212], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.5615, 0.0134, 1, 0.43, 0.4167, 748, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testInsertInlineBlipCantInsertAtTheBeginning", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInsertInlineBlipCantInsertAtTheBeginning(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEquals(1, len(self.all_blips))\n self.assertRaises(IndexError, blip.insert_inline_blip, 0)\n self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L209_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "vector": [14, 2, 0.5588, 0.0027, 2, 0.75, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L210_C4", "label": "assertEquals()", "type": "expression", "loc": [210, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "vector": [8, 2, 0.5615, 0.0027, 2, 0.75, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L211_C4", "label": "assertRaises()", "type": "expression", "loc": [211, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "vector": [8, 2, 0.5642, 0.0027, 2, 0.75, 0.6667, 11, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "assertRaises", "arg_names": [], "import_names": [], "rhs_call_name": "assertRaises", "annotation": ""}, "snippet": " self.assertRaises(IndexError, blip.insert_inline_blip, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L212_C4", "label": "assertEquals()", "type": "expression", "loc": [212, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "vector": [8, 2, 0.5668, 0.0027, 2, 0.75, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.all_blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "label": "testDocumentModify", "type": "function", "loc": [214, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.5802, 0.0187, 1, 0.43, 0.4583, 35, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDocumentModify", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDocumentModify(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('a text with text and then some text')\n blip[7].insert('text ')\n blip.all('text').replace('thing')\n self.assertEquals('a thing thing with thing and then some thing',\n blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L215_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "vector": [14, 2, 0.5749, 0.0027, 2, 0.07, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L216_C4", "label": "replace()", "type": "expression", "loc": [216, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "vector": [8, 2, 0.5775, 0.0027, 2, 0.07, 0.25, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('a text with text and then some text')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L217_C4", "label": "insert()", "type": "expression", "loc": [217, 217], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "vector": [8, 2, 0.5802, 0.0027, 2, 0.07, 0.5, 368, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip[7].insert('text ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L218_C4", "label": "replace()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "vector": [8, 2, 0.5829, 0.0027, 2, 0.07, 0.75, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all('text').replace('thing')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L219_C4", "label": "assertEquals()", "type": "expression", "loc": [219, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "vector": [8, 2, 0.5869, 0.0053, 2, 0.07, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('a thing thing with thing and then some thing',\n blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "label": "testIteration", "type": "function", "loc": [222, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.6056, 0.0267, 1, 0.43, 0.5, 806, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testIteration", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testIteration(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('aaa 012 aaa 345 aaa 322')\n count = 0\n prev = -1\n for start, end in blip.all('aaa'):\n count += 1\n self.assertTrue(prev < start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L223_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [223, 223], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [14, 2, 0.5963, 0.0027, 2, 0.98, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L224_C4", "label": "replace()", "type": "expression", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [8, 2, 0.5989, 0.0027, 2, 0.98, 0.2, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('aaa 012 aaa 345 aaa 322')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L225_C4", "label": "count =", "type": "assigned_variable", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [14, 2, 0.6016, 0.0027, 2, 0.98, 0.4, 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_1139:Assign_L226_C4", "label": "prev =", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [14, 2, 0.6043, 0.0027, 2, 0.98, 0.6, 749, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4", "label": "for start, end", "type": "for", "loc": [227, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [6, 2, 0.611, 0.0107, 2, 0.98, 0.8, 670, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "start, end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for start, end in blip.all('aaa'):\n count += 1\n self.assertTrue(prev < start)\n prev = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L229_C6", "label": "assertTrue()", "type": "expression", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4", "vector": [8, 3, 0.6123, 0.0027, 3, 0.81, 0.0, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(prev < start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L230_C6", "label": "prev =", "type": "assigned_variable", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4", "vector": [14, 3, 0.615, 0.0027, 3, 0.81, 1.0, 749, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev = start"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L231_C4", "label": "assertEquals()", "type": "expression", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "vector": [8, 2, 0.6176, 0.0027, 2, 0.98, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "label": "testBlipRefValue", "type": "function", "loc": [234, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.6671, 0.0856, 1, 0.43, 0.5417, 423, 0, 1, 0, 0, 0, 0, 22], "semantic": {"name": "testBlipRefValue", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipRefValue(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n content = blip.text\n content = content[:4] + content[5:]\n del blip[4]\n self.assertEquals(content, blip.text)\n\n content = content[:2] + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L235_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6283, 0.0027, 2, 0.63, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L236_C4", "label": "content =", "type": "assigned_variable", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.631, 0.0027, 2, 0.63, 0.0455, 273, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = blip.text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L237_C4", "label": "content =", "type": "assigned_variable", "loc": [237, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6337, 0.0027, 2, 0.63, 0.0909, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:4] + content[5:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L239_C4", "label": "assertEquals()", "type": "expression", "loc": [239, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.639, 0.0027, 2, 0.63, 0.1364, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L241_C4", "label": "content =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6444, 0.0027, 2, 0.63, 0.1818, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:2] + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L243_C4", "label": "assertEquals()", "type": "expression", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6497, 0.0027, 2, 0.63, 0.2273, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L245_C4", "label": "assign", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6551, 0.0027, 2, 0.63, 0.2727, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip[2:3] = 'bike'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L246_C4", "label": "content =", "type": "assigned_variable", "loc": [246, 246], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6578, 0.0027, 2, 0.63, 0.3182, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = content[:2] + 'bike' + content[3:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L247_C4", "label": "assertEquals()", "type": "expression", "loc": [247, 247], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6604, 0.0027, 2, 0.63, 0.3636, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(content, blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L249_C4", "label": "url =", "type": "assigned_variable", "loc": [249, 249], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6658, 0.0027, 2, 0.63, 0.4091, 789, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = 'http://www.test.com/image.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L250_C4", "label": "append()", "type": "expression", "loc": [250, 250], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6684, 0.0027, 2, 0.63, 0.4545, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Image(url=url))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L251_C4", "label": "assertEqual()", "type": "expression", "loc": [251, 251], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6711, 0.0027, 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(url, blip.first(element.Image).url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L253_C4", "label": "url2 =", "type": "assigned_variable", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.6765, 0.0027, 2, 0.63, 0.5455, 325, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "url2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url2 = 'http://www.test.com/another.png'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L254_C4", "label": "update_element()", "type": "expression", "loc": [254, 254], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6791, 0.0027, 2, 0.63, 0.5909, 879, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": [], "import_names": [], "rhs_call_name": "update_element", "annotation": ""}, "snippet": " blip[-1].update_element({'url': url2})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L255_C4", "label": "assertEqual()", "type": "expression", "loc": [255, 255], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6818, 0.0027, 2, 0.63, 0.6364, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(url2, blip.first(element.Image).url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L257_C4", "label": "assertTrue()", "type": "expression", "loc": [257, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6872, 0.0027, 2, 0.63, 0.6818, 170, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip[3:5] == blip.text[3:5])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L259_C4", "label": "append()", "type": "expression", "loc": [259, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6925, 0.0027, 2, 0.63, 0.7273, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('geheim')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L260_C4", "label": "assertTrue()", "type": "expression", "loc": [260, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6952, 0.0027, 2, 0.63, 0.7727, 170, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertTrue", "arg_names": [], "import_names": [], "rhs_call_name": "assertTrue", "annotation": ""}, "snippet": " self.assertTrue(blip.first('geheim'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L261_C4", "label": "assertFalse()", "type": "expression", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.6979, 0.0027, 2, 0.63, 0.8182, 861, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "assertFalse", "arg_names": [], "import_names": [], "rhs_call_name": "assertFalse", "annotation": ""}, "snippet": " self.assertFalse(blip.first(element.Button))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L262_C4", "label": "append()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.7005, 0.0027, 2, 0.63, 0.8636, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append(element.Button(name='test1', value='Click'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L263_C4", "label": "button = first()", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [14, 2, 0.7032, 0.0027, 2, 0.63, 0.9091, 95, 3, 1, 0, 0, 199, 10, 1], "semantic": {"name": "button", "arg_names": [], "import_names": [], "rhs_call_name": "first", "annotation": ""}, "snippet": " button = blip.first(element.Button)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L264_C4", "label": "update_element()", "type": "expression", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.7059, 0.0027, 2, 0.63, 0.9545, 879, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update_element", "arg_names": [], "import_names": [], "rhs_call_name": "update_element", "annotation": ""}, "snippet": " button.update_element({'name': 'test2'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L265_C4", "label": "assertEqual()", "type": "expression", "loc": [265, 265], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "vector": [8, 2, 0.7086, 0.0027, 2, 0.63, 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('test2', button.name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "label": "testReplace", "type": "function", "loc": [267, 271], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.7193, 0.0134, 1, 0.43, 0.5833, 144, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testReplace", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplace(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n blip.all().replace('\\nxxxx')\n blip.all('yyy').replace('zzz')\n self.assertEqual('\\nxxxx', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L268_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [268, 268], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "vector": [14, 2, 0.7166, 0.0027, 2, 0.86, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L269_C4", "label": "replace()", "type": "expression", "loc": [269, 269], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "vector": [8, 2, 0.7193, 0.0027, 2, 0.86, 0.3333, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all().replace('\\nxxxx')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L270_C4", "label": "replace()", "type": "expression", "loc": [270, 270], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "vector": [8, 2, 0.7219, 0.0027, 2, 0.86, 0.6667, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all('yyy').replace('zzz')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L271_C4", "label": "assertEqual()", "type": "expression", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "vector": [8, 2, 0.7246, 0.0027, 2, 0.86, 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('\\nxxxx', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "label": "testDeleteRangeThatSpansAcrossAnnotationEndPoint", "type": "function", "loc": [273, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.7406, 0.0241, 1, 0.43, 0.625, 559, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDeleteRangeThatSpansAcrossAnnotationEndPoint", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDeleteRangeThatSpansAcrossAnnotationEndPoint(self):\n json = ('[{\"range\":{\"start\":1,\"end\":3},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).delete()\n self.assertEqual('\\nF bar.', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L274_C4", "label": "json =", "type": "assigned_variable", "loc": [274, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [14, 2, 0.7326, 0.0027, 2, 0.52, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":3},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L275_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [275, 277], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [14, 2, 0.738, 0.008, 2, 0.52, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L278_C4", "label": "delete()", "type": "expression", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [8, 2, 0.7433, 0.0027, 2, 0.52, 0.4, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 4).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L279_C4", "label": "assertEqual()", "type": "expression", "loc": [279, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [8, 2, 0.746, 0.0027, 2, 0.52, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L280_C4", "label": "assertEqual()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [8, 2, 0.7487, 0.0027, 2, 0.52, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L281_C4", "label": "assertEqual()", "type": "expression", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "vector": [8, 2, 0.7513, 0.0027, 2, 0.52, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "label": "testInsertBeforeAnnotationStartPoint", "type": "function", "loc": [283, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.7674, 0.0241, 1, 0.43, 0.6667, 402, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testInsertBeforeAnnotationStartPoint", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInsertBeforeAnnotationStartPoint(self):\n json = ('[{\"range\":{\"start\":4,\"end\":9},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.at(4).insert('d and')\n self.assertEqual('\\nFood and bar.', blip.text)\n self.assertEqual(9, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L284_C4", "label": "json =", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [14, 2, 0.7594, 0.0027, 2, 0.09, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":4,\"end\":9},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L285_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [285, 287], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [14, 2, 0.7647, 0.008, 2, 0.09, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L288_C4", "label": "insert()", "type": "expression", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [8, 2, 0.7701, 0.0027, 2, 0.09, 0.4, 368, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": " blip.at(4).insert('d and')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L289_C4", "label": "assertEqual()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [8, 2, 0.7727, 0.0027, 2, 0.09, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nFood and bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L290_C4", "label": "assertEqual()", "type": "expression", "loc": [290, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [8, 2, 0.7754, 0.0027, 2, 0.09, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(9, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L291_C4", "label": "assertEqual()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "vector": [8, 2, 0.7781, 0.0027, 2, 0.09, 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(14, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "label": "testDeleteRangeInsideAnnotation", "type": "function", "loc": [293, 302], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.7955, 0.0267, 1, 0.43, 0.7083, 406, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testDeleteRangeInsideAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testDeleteRangeInsideAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).delete()\n\n self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L294_C4", "label": "json =", "type": "assigned_variable", "loc": [294, 294], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [14, 2, 0.7861, 0.0027, 2, 0.54, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L295_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [295, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [14, 2, 0.7914, 0.008, 2, 0.54, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L298_C4", "label": "delete()", "type": "expression", "loc": [298, 298], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [8, 2, 0.7968, 0.0027, 2, 0.54, 0.4, 266, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " blip.range(2, 4).delete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L300_C4", "label": "assertEqual()", "type": "expression", "loc": [300, 300], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [8, 2, 0.8021, 0.0027, 2, 0.54, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L301_C4", "label": "assertEqual()", "type": "expression", "loc": [301, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [8, 2, 0.8048, 0.0027, 2, 0.54, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L302_C4", "label": "assertEqual()", "type": "expression", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "vector": [8, 2, 0.8075, 0.0027, 2, 0.54, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "label": "testReplaceInsideAnnotation", "type": "function", "loc": [304, 317], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.8302, 0.0374, 1, 0.43, 0.75, 841, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testReplaceInsideAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplaceInsideAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 4).replace('ooo')\n self.assertEqual('\\nFooo bar.', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L305_C4", "label": "json =", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [14, 2, 0.8155, 0.0027, 2, 0.55, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":5},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L306_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [306, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [14, 2, 0.8209, 0.008, 2, 0.55, 0.1111, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L309_C4", "label": "replace()", "type": "expression", "loc": [309, 309], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8262, 0.0027, 2, 0.55, 0.2222, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 4).replace('ooo')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L310_C4", "label": "assertEqual()", "type": "expression", "loc": [310, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8289, 0.0027, 2, 0.55, 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('\\nFooo bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L311_C4", "label": "assertEqual()", "type": "expression", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8316, 0.0027, 2, 0.55, 0.4444, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L312_C4", "label": "assertEqual()", "type": "expression", "loc": [312, 312], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8342, 0.0027, 2, 0.55, 0.5556, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(6, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L314_C4", "label": "replace()", "type": "expression", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8396, 0.0027, 2, 0.55, 0.6667, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 5).replace('o')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L315_C4", "label": "assertEqual()", "type": "expression", "loc": [315, 315], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8422, 0.0027, 2, 0.55, 0.7778, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nFo bar.', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L316_C4", "label": "assertEqual()", "type": "expression", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8449, 0.0027, 2, 0.55, 0.8889, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L317_C4", "label": "assertEqual()", "type": "expression", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "vector": [8, 2, 0.8476, 0.0027, 2, 0.55, 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(4, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "label": "testReplaceSpanAnnotation", "type": "function", "loc": [319, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.8636, 0.0241, 1, 0.43, 0.7917, 938, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testReplaceSpanAnnotation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testReplaceSpanAnnotation(self):\n json = ('[{\"range\":{\"start\":1,\"end\":4},\"name\":\"style\",\"value\":\"bold\"}]')\n blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')\n blip.range(2, 9).replace('')\n self.assertEqual('\\nF', blip.text)\n self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L320_C4", "label": "json =", "type": "assigned_variable", "loc": [320, 320], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [14, 2, 0.8556, 0.0027, 2, 0.26, 0.0, 463, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " json = ('[{\"range\":{\"start\":1,\"end\":4},\"name\":\"style\",\"value\":\"bold\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L321_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [321, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [14, 2, 0.861, 0.008, 2, 0.26, 0.2, 134, 3, 3, 0, 0, 893, 10, 2], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID,\n annotations=simplejson.loads(json),\n content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L324_C4", "label": "replace()", "type": "expression", "loc": [324, 324], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [8, 2, 0.8663, 0.0027, 2, 0.26, 0.4, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.range(2, 9).replace('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L325_C4", "label": "assertEqual()", "type": "expression", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [8, 2, 0.869, 0.0027, 2, 0.26, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('\\nF', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L326_C4", "label": "assertEqual()", "type": "expression", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [8, 2, 0.8717, 0.0027, 2, 0.26, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(1, blip.annotations['style'][0].start)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L327_C4", "label": "assertEqual()", "type": "expression", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "vector": [8, 2, 0.8743, 0.0027, 2, 0.26, 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, blip.annotations['style'][0].end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "label": "testSearchWithNoMatchShouldNotGenerateOperation", "type": "function", "loc": [329, 334], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.8864, 0.016, 1, 0.43, 0.8333, 585, 0, 1, 0, 0, 0, 0, 9], "semantic": {"name": "testSearchWithNoMatchShouldNotGenerateOperation", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSearchWithNoMatchShouldNotGenerateOperation(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID)\n self.assertEqual(-1, blip.text.find(':('))\n self.assertEqual(0, len(self.operation_queue))\n blip.all(':(').replace(':)')\n self.assertEqual(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L330_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [330, 330], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "vector": [14, 2, 0.8824, 0.0027, 2, 0.97, 0.0, 134, 3, 1, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L331_C4", "label": "assertEqual()", "type": "expression", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "vector": [8, 2, 0.885, 0.0027, 2, 0.97, 0.25, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(-1, blip.text.find(':('))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L332_C4", "label": "assertEqual()", "type": "expression", "loc": [332, 332], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "vector": [8, 2, 0.8877, 0.0027, 2, 0.97, 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(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L333_C4", "label": "replace()", "type": "expression", "loc": [333, 333], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "vector": [8, 2, 0.8904, 0.0027, 2, 0.97, 0.75, 293, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " blip.all(':(').replace(':)')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L334_C4", "label": "assertEqual()", "type": "expression", "loc": [334, 334], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "vector": [8, 2, 0.893, 0.0027, 2, 0.97, 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(0, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "label": "testBlipsRemoveWithId", "type": "function", "loc": [336, 346], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.9118, 0.0294, 1, 0.43, 0.875, 636, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "testBlipsRemoveWithId", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBlipsRemoveWithId(self):\n blip_dict = {\n ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID]),\n CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n }\n blips = blip.Blips(blip_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L337_C4", "label": "blip_dict =", "type": "assigned_variable", "loc": [337, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "vector": [14, 2, 0.9078, 0.016, 2, 0.66, 0.0, 213, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "blip_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blip_dict = {\n ROOT_BLIP_ID: self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID]),\n CHILD_BLIP_ID: self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L343_C4", "label": "blips = Blips()", "type": "assigned_variable", "loc": [343, 343], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "vector": [14, 2, 0.9171, 0.0027, 2, 0.66, 0.25, 391, 3, 1, 0, 0, 32, 10, 1], "semantic": {"name": "blips", "arg_names": [], "import_names": [], "rhs_call_name": "Blips", "annotation": ""}, "snippet": " blips = blip.Blips(blip_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L344_C4", "label": "_remove_with_id()", "type": "expression", "loc": [344, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "vector": [8, 2, 0.9198, 0.0027, 2, 0.66, 0.5, 122, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_remove_with_id", "arg_names": [], "import_names": [], "rhs_call_name": "_remove_with_id", "annotation": ""}, "snippet": " blips._remove_with_id(CHILD_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L345_C4", "label": "assertEqual()", "type": "expression", "loc": [345, 345], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "vector": [8, 2, 0.9225, 0.0027, 2, 0.66, 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(blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L346_C4", "label": "assertEqual()", "type": "expression", "loc": [346, 346], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "vector": [8, 2, 0.9251, 0.0027, 2, 0.66, 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(0, len(blips[ROOT_BLIP_ID].child_blip_ids))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "label": "testAppendMarkup", "type": "function", "loc": [348, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.9372, 0.016, 1, 0.43, 0.9167, 371, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testAppendMarkup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testAppendMarkup(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')\n markup = '<p><span>markup<span> content</p>'\n blip.append_markup(markup)\n self.assertEqual(1, len(self.operation_queue))\n self.assertEqual('\\nFoo bar.\\nmarkup content', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L349_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [349, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "vector": [14, 2, 0.9332, 0.0027, 2, 0.56, 0.0, 134, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L350_C4", "label": "markup =", "type": "assigned_variable", "loc": [350, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "vector": [14, 2, 0.9358, 0.0027, 2, 0.56, 0.25, 922, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "markup", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markup = '<p><span>markup<span> content</p>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L351_C4", "label": "append_markup()", "type": "expression", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "vector": [8, 2, 0.9385, 0.0027, 2, 0.56, 0.5, 513, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append_markup", "arg_names": [], "import_names": [], "rhs_call_name": "append_markup", "annotation": ""}, "snippet": " blip.append_markup(markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L352_C4", "label": "assertEqual()", "type": "expression", "loc": [352, 352], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "vector": [8, 2, 0.9412, 0.0027, 2, 0.56, 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(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L353_C4", "label": "assertEqual()", "type": "expression", "loc": [353, 353], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "vector": [8, 2, 0.9439, 0.0027, 2, 0.56, 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('\\nFoo bar.\\nmarkup content', blip.text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "label": "testBundledAnnotations", "type": "function", "loc": [355, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.9559, 0.016, 1, 0.43, 0.9583, 926, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "testBundledAnnotations", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testBundledAnnotations(self):\n blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')\n blip.append('not bold')\n blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])\n self.assertEqual(2, len(blip.annotations))\n self.assertEqual('bold', blip.annotations['style/fontWeight'][0].value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L356_C4", "label": "blip = new_blip()", "type": "assigned_variable", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "vector": [14, 2, 0.9519, 0.0027, 2, 0.77, 0.0, 134, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " blip = self.new_blip(blipId=ROOT_BLIP_ID, content='\\nFoo bar.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L357_C4", "label": "append()", "type": "expression", "loc": [357, 357], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "vector": [8, 2, 0.9545, 0.0027, 2, 0.77, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('not bold')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L358_C4", "label": "append()", "type": "expression", "loc": [358, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "vector": [8, 2, 0.9572, 0.0027, 2, 0.77, 0.5, 243, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blip.append('bold', bundled_annotations=[('style/fontWeight', 'bold')])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L359_C4", "label": "assertEqual()", "type": "expression", "loc": [359, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "vector": [8, 2, 0.9599, 0.0027, 2, 0.77, 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(2, len(blip.annotations))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L360_C4", "label": "assertEqual()", "type": "expression", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "vector": [8, 2, 0.9626, 0.0027, 2, 0.77, 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('bold', blip.annotations['style/fontWeight'][0].value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "label": "testInlineBlipOffset", "type": "function", "loc": [362, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "vector": [2, 1, 0.9799, 0.0267, 1, 0.43, 1.0, 458, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "testInlineBlipOffset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testInlineBlipOffset(self):\n offset = 14\n self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID],\n elements={str(offset):\n {'type': element.Element.INLINE_BLIP_TYPE,\n 'properties': {'id': CHILD_BLIP_ID}}})\n child = self.new_blip(blipId=CHILD_BLIP_ID,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L363_C4", "label": "offset =", "type": "assigned_variable", "loc": [363, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "vector": [14, 2, 0.9706, 0.0027, 2, 0.64, 0.0, 132, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " offset = 14"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L364_C4", "label": "new_blip()", "type": "expression", "loc": [364, 368], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "vector": [8, 2, 0.9786, 0.0134, 2, 0.64, 0.3333, 893, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " self.new_blip(blipId=ROOT_BLIP_ID,\n childBlipIds=[CHILD_BLIP_ID],\n elements={str(offset):\n {'type': element.Element.INLINE_BLIP_TYPE,\n 'properties': {'id': CHILD_BLIP_ID}}})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L369_C4", "label": "child = new_blip()", "type": "assigned_variable", "loc": [369, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "vector": [14, 2, 0.988, 0.0053, 2, 0.64, 0.6667, 967, 3, 2, 0, 0, 893, 10, 1], "semantic": {"name": "child", "arg_names": [], "import_names": [], "rhs_call_name": "new_blip", "annotation": ""}, "snippet": " child = self.new_blip(blipId=CHILD_BLIP_ID,\n parentBlipId=ROOT_BLIP_ID)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L371_C4", "label": "assertEqual()", "type": "expression", "loc": [371, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "vector": [8, 2, 0.992, 0.0027, 2, 0.64, 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(offset, child.inline_blip_offset)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L373_C0", "label": "if", "type": "if", "loc": [373, 374], "level": 0, "parent": null, "vector": [4, 0, 0.9987, 0.0053, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L374_C2", "label": "main()", "type": "expression", "loc": [374, 374], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L373_C0", "vector": [8, 1, 1.0, 0.0027, 1, 0.04, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L64_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L121_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L120_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L154_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L154_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L155_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L156_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Return_L157_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L175_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L184_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L190_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L204_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L194_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L208_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L212_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L216_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L214_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L223_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L224_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L229_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:For_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L230_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L222_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L239_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L246_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L249_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L250_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L251_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L253_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L254_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L255_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L259_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L260_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L261_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L234_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L269_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L267_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L271_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L278_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L279_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L273_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L285_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L290_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L294_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L298_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L300_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L293_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L302_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L306_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L310_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L312_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L314_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L315_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L316_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L317_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L321_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L324_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L319_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L331_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L332_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L333_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L329_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L343_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L345_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L336_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L349_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L350_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L348_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L353_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L356_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L355_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L360_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:ClassDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L364_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Assign_L369_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:FunctionDef_L362_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1139:If_L373_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1139:Expr_L374_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Support for operations that can be applied to the server.
Contains classes and utilities for creating operations that are to be
applied on the server.
"""
import errors
import random
import util
import sys
PROTOCOL_VERSION = '0.21'
# Operation Types
WAVELET_APPEND_BLIP = 'wavelet.appendBlip'
WAVELET_SET_TITLE = 'wavelet.setTitle'
WAVELET_ADD_PARTICIPANT = 'wavelet.participant.add'
WAVELET_DATADOC_SET = 'wavelet.datadoc.set'
WAVELET_MODIFY_TAG = 'wavelet.modifyTag'
WAVELET_MODIFY_PARTICIPANT_ROLE = 'wavelet.modifyParticipantRole'
BLIP_CREATE_CHILD = 'blip.createChild'
BLIP_DELETE = 'blip.delete'
DOCUMENT_APPEND_MARKUP = 'document.appendMarkup'
DOCUMENT_INLINE_BLIP_INSERT = 'document.inlineBlip.insert'
DOCUMENT_MODIFY = 'document.modify'
ROBOT_CREATE_WAVELET = 'robot.createWavelet'
ROBOT_FETCH_WAVE = 'robot.fetchWave'
ROBOT_NOTIFY_CAPABILITIES_HASH = 'robot.notifyCapabilitiesHash'
class Operation(object):
"""Represents a generic operation applied on the server.
This operation class contains data that is filled in depending on the
operation type.
It can be used directly, but doing so will not result
in local, transient reflection of state on the blips. In other words,
creating a 'delete blip' operation will not remove the blip from the local
context for the duration of this session. It is better to use the OpBased
model classes directly instead.
"""
def __init__(self, method, opid, params):
"""Initializes this operation with contextual data.
Args:
method: Method to call or type of operation.
opid: The id of the operation. Any callbacks will refer to these.
params: An operation type dependent dictionary
"""
self.method = method
self.id = opid
self.params = params
def __str__(self):
return '%s[%s]%s' % (self.method, self.id, str(self.params))
def set_param(self, param, value):
self.params[param] = value
return self
def serialize(self, method_prefix=''):
"""Serialize the operation.
Args:
method_prefix: prefixed for each method name to allow for specifying
a namespace.
Returns:
a dict representation of the operation.
"""
if method_prefix and not method_prefix.endswith('.'):
method_prefix += '.'
return {'method': method_prefix + self.method,
'id': self.id,
'params': util.serialize(self.params)}
def set_optional(self, param, value):
"""Sets an optional parameter.
If value is None or "", this is a no op. Otherwise it calls
set_param.
"""
if value == '' or value is None:
return self
else:
return self.set_param(param, value)
class OperationQueue(object):
"""Wraps the queuing of operations using easily callable functions.
The operation queue wraps single operations as functions and queues the
resulting operations in-order. Typically there shouldn't be a need to
call this directly unless operations are needed on entities outside
of the scope of the robot. For example, to modify a blip that
does not exist in the current context, you might specify the wave, wavelet
and blip id to generate an operation.
Any calls to this will not be reflected in the robot in any way.
For example, calling wavelet_append_blip will not result in a new blip
being added to the robot, only an operation to be applied on the
server.
"""
# Some class global counters:
_next_operation_id = 1
def __init__(self, proxy_for_id=None):
self.__pending = []
self._capability_hash = 0
self._proxy_for_id = proxy_for_id
def _new_blipdata(self, wave_id, wavelet_id, initial_content='',
parent_blip_id=None):
"""Creates JSON of the blip used for this session."""
temp_blip_id = 'TBD_%s_%s' % (wavelet_id,
hex(random.randint(0, sys.maxint)))
return {'waveId': wave_id,
'waveletId': wavelet_id,
'blipId': temp_blip_id,
'content': initial_content,
'parentBlipId': parent_blip_id}
def _new_waveletdata(self, domain, participants):
"""Creates an ephemeral WaveletData instance used for this session.
Args:
domain: the domain to create the data for.
participants initially on the wavelet
Returns:
Blipdata (for the rootblip), WaveletData.
"""
wave_id = domain + '!TBD_%s' % hex(random.randint(0, sys.maxint))
wavelet_id = domain + '!conv+root'
root_blip_data = self._new_blipdata(wave_id, wavelet_id)
participants = set(participants)
wavelet_data = {'waveId': wave_id,
'waveletId': wavelet_id,
'rootBlipId': root_blip_data['blipId'],
'participants': participants}
return root_blip_data, wavelet_data
def __len__(self):
return len(self.__pending)
def __iter__(self):
return self.__pending.__iter__()
def clear(self):
self.__pending = []
def proxy_for(self, proxy):
"""Return a view of this operation queue with the proxying for set to proxy.
This method returns a new instance of an operation queue that shares the
operation list, but has a different proxying_for_id set so the robot using
this new queue will send out operations with the proxying_for field set.
"""
res = OperationQueue()
res.__pending = self.__pending
res._capability_hash = self._capability_hash
res._proxy_for_id = proxy
return res
def set_capability_hash(self, capability_hash):
self._capability_hash = capability_hash
def serialize(self):
first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,
'0',
{'capabilitiesHash': self._capability_hash,
'protocolVersion': PROTOCOL_VERSION})
operations = [first] + self.__pending
res = util.serialize(operations)
return res
def copy_operations(self, other_queue):
"""Copy the pending operations from other_queue into this one."""
for op in other_queue:
self.__pending.append(op)
def new_operation(self, method, wave_id, wavelet_id, props=None, **kwprops):
"""Creates and adds a new operation to the operation list."""
if props is None:
props = {}
props.update(kwprops)
props['waveId'] = wave_id
props['waveletId'] = wavelet_id
if self._proxy_for_id:
props['proxyingFor'] = self._proxy_for_id
operation = Operation(method,
'op%s' % OperationQueue._next_operation_id,
props)
self.__pending.append(operation)
OperationQueue._next_operation_id += 1
return operation
def wavelet_append_blip(self, wave_id, wavelet_id, initial_content=''):
"""Appends a blip to a wavelet.
Args:
wave_id: The wave id owning the containing wavelet.
wavelet_id: The wavelet id that this blip should be appended to.
initial_content: optionally the content to start with
Returns:
JSON representing the information of the new blip.
"""
blip_data = self._new_blipdata(wave_id, wavelet_id, initial_content)
self.new_operation(WAVELET_APPEND_BLIP, wave_id,
wavelet_id, blipData=blip_data)
return blip_data
def wavelet_add_participant(self, wave_id, wavelet_id, participant_id):
"""Adds a participant to a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
participant_id: Id of the participant to add.
Returns:
data for the root_blip, wavelet
"""
return self.new_operation(WAVELET_ADD_PARTICIPANT, wave_id, wavelet_id,
participantId=participant_id)
def wavelet_datadoc_set(self, wave_id, wavelet_id, name, data):
"""Sets a key/value pair on the data document of a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
name: The key name for this data.
data: The value of the data to set.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_DATADOC_SET, wave_id, wavelet_id,
datadocName=name, datadocValue=data)
def robot_create_wavelet(self, domain, participants=None, message=''):
"""Creates a new wavelet.
Args:
domain: the domain to create the wave in
participants: initial participants on this wavelet or None if none
message: an optional payload that is returned with the corresponding
event.
Returns:
data for the root_blip, wavelet
"""
if participants is None:
participants = []
blip_data, wavelet_data = self._new_waveletdata(domain, participants)
op = self.new_operation(ROBOT_CREATE_WAVELET,
wave_id=wavelet_data['waveId'],
wavelet_id=wavelet_data['waveletId'],
waveletData=wavelet_data)
op.set_optional('message', message)
return blip_data, wavelet_data
def robot_fetch_wave(self, wave_id, wavelet_id):
"""Requests a snapshot of the specified wave.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(ROBOT_FETCH_WAVE, wave_id, wavelet_id)
def wavelet_set_title(self, wave_id, wavelet_id, title):
"""Sets the title of a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
title: The title to set.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_SET_TITLE, wave_id, wavelet_id,
waveletTitle=title)
def wavelet_modify_participant_role(
self, wave_id, wavelet_id, participant_id, role):
"""Modify the role of a participant on a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
participant_id: Id of the participant to add.
role: the new roles
Returns:
data for the root_blip, wavelet
"""
return self.new_operation(WAVELET_MODIFY_PARTICIPANT_ROLE, wave_id,
wavelet_id, participantId=participant_id,
participantRole=role)
def wavelet_modify_tag(self, wave_id, wavelet_id, tag, modify_how=None):
"""Modifies a tag in a wavelet.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
tag: The tag (a string).
modify_how: (optional) how to apply the tag. The default is to add
the tag. Specify 'remove' to remove. Specify None or 'add' to
add.
Returns:
The operation created.
"""
return self.new_operation(WAVELET_MODIFY_TAG, wave_id, wavelet_id,
name=tag).set_optional("modify_how", modify_how)
def blip_create_child(self, wave_id, wavelet_id, blip_id):
"""Creates a child blip of another blip.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
JSON of blip for which further operations can be applied.
"""
blip_data = self._new_blipdata(wave_id, wavelet_id, parent_blip_id=blip_id)
self.new_operation(BLIP_CREATE_CHILD, wave_id, wavelet_id,
blipId=blip_id,
blipData=blip_data)
return blip_data
def blip_delete(self, wave_id, wavelet_id, blip_id):
"""Deletes the specified blip.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(BLIP_DELETE, wave_id, wavelet_id, blipId=blip_id)
def document_append_markup(self, wave_id, wavelet_id, blip_id, content):
"""Appends content with markup to a document.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
content: The markup content to append.
Returns:
The operation created.
"""
return self.new_operation(DOCUMENT_APPEND_MARKUP, wave_id, wavelet_id,
blipId=blip_id, content=content)
def document_modify(self, wave_id, wavelet_id, blip_id):
"""Creates and queues a document modify operation
The returned operation still needs to be filled with details before
it makes sense.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
Returns:
The operation created.
"""
return self.new_operation(DOCUMENT_MODIFY,
wave_id,
wavelet_id,
blipId=blip_id)
def document_inline_blip_insert(self, wave_id, wavelet_id, blip_id, position):
"""Inserts an inline blip at a specific location.
Args:
wave_id: The wave id owning that this operation is applied to.
wavelet_id: The wavelet id that this operation is applied to.
blip_id: The blip id that this operation is applied to.
position: The position in the document to insert the blip.
Returns:
JSON data for the blip that was created for further operations.
"""
inline_blip_data = self._new_blipdata(wave_id, wavelet_id)
inline_blip_data['parentBlipId'] = blip_id
self.new_operation(DOCUMENT_INLINE_BLIP_INSERT, wave_id, wavelet_id,
blipId=blip_id,
index=position,
blipData=inline_blip_data)
return inline_blip_data
| ajibawa-2023/Python-Code-Large/train/row_1140 | 147 | 419 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.0453, 0.0119, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Support for operations that can be applied to the server.\n\nContains classes and utilities for creating operations that are to be\napplied on the server.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Import_L23_C0", "label": "errors import errors", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0549, 0.0024, 0, 0.66, 0.0476, 841, 0, 1, 0, 0, 841, 0, 0], "semantic": {"name": "errors", "arg_names": [], "import_names": ["errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "import errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Import_L24_C0", "label": "random import random", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0573, 0.0024, 0, 0.66, 0.0952, 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_1140:Import_L25_C0", "label": "util import util", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.0597, 0.0024, 0, 0.66, 0.1429, 811, 0, 1, 0, 0, 811, 0, 0], "semantic": {"name": "util", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Import_L26_C0", "label": "sys import sys", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0621, 0.0024, 0, 0.66, 0.1905, 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_1140:Assign_L29_C0", "label": "PROTOCOL_VERSION =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.0692, 0.0024, 0, 0.66, 0.2381, 310, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PROTOCOL_VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "PROTOCOL_VERSION = '0.21'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L32_C0", "label": "WAVELET_APPEND_BLIP =", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.0764, 0.0024, 0, 0.66, 0.2857, 78, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_APPEND_BLIP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_APPEND_BLIP = 'wavelet.appendBlip'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L33_C0", "label": "WAVELET_SET_TITLE =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.0788, 0.0024, 0, 0.66, 0.3333, 503, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_SET_TITLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_SET_TITLE = 'wavelet.setTitle'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L34_C0", "label": "WAVELET_ADD_PARTICIPANT =", "type": "assigned_variable", "loc": [34, 34], "level": 0, "parent": null, "vector": [14, 0, 0.0811, 0.0024, 0, 0.66, 0.381, 164, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_ADD_PARTICIPANT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_ADD_PARTICIPANT = 'wavelet.participant.add'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L35_C0", "label": "WAVELET_DATADOC_SET =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.0835, 0.0024, 0, 0.66, 0.4286, 904, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_DATADOC_SET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_DATADOC_SET = 'wavelet.datadoc.set'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L36_C0", "label": "WAVELET_MODIFY_TAG =", "type": "assigned_variable", "loc": [36, 36], "level": 0, "parent": null, "vector": [14, 0, 0.0859, 0.0024, 0, 0.66, 0.4762, 603, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_MODIFY_TAG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_MODIFY_TAG = 'wavelet.modifyTag'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L37_C0", "label": "WAVELET_MODIFY_PARTICIPANT_ROLE =", "type": "assigned_variable", "loc": [37, 37], "level": 0, "parent": null, "vector": [14, 0, 0.0883, 0.0024, 0, 0.66, 0.5238, 318, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_MODIFY_PARTICIPANT_ROLE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_MODIFY_PARTICIPANT_ROLE = 'wavelet.modifyParticipantRole'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L38_C0", "label": "BLIP_CREATE_CHILD =", "type": "assigned_variable", "loc": [38, 38], "level": 0, "parent": null, "vector": [14, 0, 0.0907, 0.0024, 0, 0.66, 0.5714, 233, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_CREATE_CHILD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_CREATE_CHILD = 'blip.createChild'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L39_C0", "label": "BLIP_DELETE =", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.0931, 0.0024, 0, 0.66, 0.619, 775, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_DELETE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_DELETE = 'blip.delete'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L40_C0", "label": "DOCUMENT_APPEND_MARKUP =", "type": "assigned_variable", "loc": [40, 40], "level": 0, "parent": null, "vector": [14, 0, 0.0955, 0.0024, 0, 0.66, 0.6667, 593, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_APPEND_MARKUP", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_APPEND_MARKUP = 'document.appendMarkup'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L41_C0", "label": "DOCUMENT_INLINE_BLIP_INSERT =", "type": "assigned_variable", "loc": [41, 41], "level": 0, "parent": null, "vector": [14, 0, 0.0979, 0.0024, 0, 0.66, 0.7143, 604, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_INLINE_BLIP_INSERT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_INLINE_BLIP_INSERT = 'document.inlineBlip.insert'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L42_C0", "label": "DOCUMENT_MODIFY =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.1002, 0.0024, 0, 0.66, 0.7619, 23, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "DOCUMENT_MODIFY", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DOCUMENT_MODIFY = 'document.modify'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L43_C0", "label": "ROBOT_CREATE_WAVELET =", "type": "assigned_variable", "loc": [43, 43], "level": 0, "parent": null, "vector": [14, 0, 0.1026, 0.0024, 0, 0.66, 0.8095, 423, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_CREATE_WAVELET", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_CREATE_WAVELET = 'robot.createWavelet'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L44_C0", "label": "ROBOT_FETCH_WAVE =", "type": "assigned_variable", "loc": [44, 44], "level": 0, "parent": null, "vector": [14, 0, 0.105, 0.0024, 0, 0.66, 0.8571, 617, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_FETCH_WAVE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_FETCH_WAVE = 'robot.fetchWave'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L45_C0", "label": "ROBOT_NOTIFY_CAPABILITIES_HASH =", "type": "assigned_variable", "loc": [45, 45], "level": 0, "parent": null, "vector": [14, 0, 0.1074, 0.0024, 0, 0.66, 0.9048, 438, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_NOTIFY_CAPABILITIES_HASH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_NOTIFY_CAPABILITIES_HASH = 'robot.notifyCapabilitiesHash'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "label": "Operation", "type": "class", "loc": [48, 105], "level": 0, "parent": null, "vector": [3, 0, 0.1826, 0.1384, 0, 0.66, 0.9524, 222, 0, 5, 0, 0, 186, 0, 4], "semantic": {"name": "Operation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Operation(object):\n \"\"\"Represents a generic operation applied on the server.\n\n This operation class contains data that is filled in depending on the\n operation type.\n\n It can be used directly, but doing so will not result\n in local, transient reflection of state on the blips. In other words,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [8, 1, 0.1289, 0.0263, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Represents a generic operation applied on the server.\n\n This operation class contains data that is filled in depending on the\n operation type.\n\n It can be used directly, but doing so will not result\n in local, transient reflection of state on the blips. In other words,\n creating a 'delete blip' operation will not remove the blip from the local"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "label": "__init__", "type": "function", "loc": [61, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [2, 1, 0.1575, 0.0263, 1, 0.14, 0.2, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "method", "opid", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, method, opid, params):\n \"\"\"Initializes this operation with contextual data.\n\n Args:\n method: Method to call or type of operation.\n opid: The id of the operation. Any callbacks will refer to these.\n params: An operation type dependent dictionary\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L62_C4", "label": "expression", "type": "expression", "loc": [62, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "vector": [8, 2, 0.1551, 0.0167, 2, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Initializes this operation with contextual data.\n\n Args:\n method: Method to call or type of operation.\n opid: The id of the operation. Any callbacks will refer to these.\n params: An operation type dependent dictionary\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L69_C4", "label": "self.method =", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "vector": [14, 2, 0.1647, 0.0024, 2, 0.15, 0.3333, 432, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.method = method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L70_C4", "label": "self.id =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "vector": [14, 2, 0.1671, 0.0024, 2, 0.15, 0.6667, 485, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.id = opid"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L71_C4", "label": "self.params =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "vector": [14, 2, 0.1695, 0.0024, 2, 0.15, 1.0, 402, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params = params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L73_C2", "label": "__str__", "type": "function", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [2, 1, 0.1754, 0.0048, 1, 0.14, 0.4, 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]%s' % (self.method, self.id, str(self.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L73_C2", "vector": [13, 2, 0.1766, 0.0024, 2, 0.56, 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' % (self.method, self.id, str(self.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2", "label": "set_param", "type": "function", "loc": [76, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [2, 1, 0.1838, 0.0072, 1, 0.14, 0.6, 696, 0, 3, 1, 0, 0, 0, 0], "semantic": {"name": "set_param", "arg_names": ["self", "param", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_param(self, param, value):\n self.params[param] = value\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L77_C4", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2", "vector": [14, 2, 0.1838, 0.0024, 2, 0.5, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.params[param] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L78_C4", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2", "vector": [13, 2, 0.1862, 0.0024, 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 self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "label": "serialize", "type": "function", "loc": [80, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [2, 1, 0.2076, 0.0358, 1, 0.14, 0.8, 50, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self", "method_prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self, method_prefix=''):\n \"\"\"Serialize the operation.\n\n Args:\n method_prefix: prefixed for each method name to allow for specifying\n a namespace.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L81_C4", "label": "expression", "type": "expression", "loc": [81, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "vector": [8, 2, 0.2029, 0.0215, 2, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize the operation.\n\n Args:\n method_prefix: prefixed for each method name to allow for specifying\n a namespace.\n\n Returns:\n a dict representation of the operation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L90_C4", "label": "if", "type": "if", "loc": [90, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "vector": [4, 2, 0.216, 0.0048, 2, 0.85, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if method_prefix and not method_prefix.endswith('.'):\n method_prefix += '.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L92_C4", "label": "return", "type": "return", "loc": [92, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "vector": [13, 2, 0.222, 0.0072, 2, 0.85, 1.0, 0, 0, 0, 0, 0, 0, 6, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'method': method_prefix + self.method,\n 'id': self.id,\n 'params': util.serialize(self.params)}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2", "label": "set_optional", "type": "function", "loc": [96, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "vector": [2, 1, 0.2399, 0.0239, 1, 0.14, 1.0, 517, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "set_optional", "arg_names": ["self", "param", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_optional(self, param, value):\n \"\"\"Sets an optional parameter.\n\n If value is None or \"\", this is a no op. Otherwise it calls\n set_param.\n \"\"\"\n if value == '' or value is None:\n return self"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L97_C4", "label": "expression", "type": "expression", "loc": [97, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2", "vector": [8, 2, 0.2363, 0.0119, 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 an optional parameter.\n\n If value is None or \"\", this is a no op. Otherwise it calls\n set_param.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4", "label": "if", "type": "if", "loc": [102, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2", "vector": [4, 2, 0.247, 0.0095, 2, 0.88, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if value == '' or value is None:\n return self\n else:\n return self.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L103_C6", "label": "return", "type": "return", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4", "vector": [13, 3, 0.2458, 0.0024, 3, 0.14, 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_1140:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4", "vector": [13, 3, 0.2506, 0.0024, 3, 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.set_param(param, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "label": "OperationQueue", "type": "class", "loc": [108, 419], "level": 0, "parent": null, "vector": [3, 0, 0.6289, 0.7446, 0, 0.66, 1.0, 786, 0, 24, 0, 0, 186, 0, 34], "semantic": {"name": "OperationQueue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OperationQueue(object):\n \"\"\"Wraps the queuing of operations using easily callable functions.\n\n The operation queue wraps single operations as functions and queues the\n resulting operations in-order. Typically there shouldn't be a need to\n call this directly unless operations are needed on entities outside\n of the scope of the robot. For example, to modify a blip that\n does not exist in the current context, you might specify the wave, wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [8, 1, 0.2757, 0.0334, 1, 0.8, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Wraps the queuing of operations using easily callable functions.\n\n The operation queue wraps single operations as functions and queues the\n resulting operations in-order. Typically there shouldn't be a need to\n call this directly unless operations are needed on entities outside\n of the scope of the robot. For example, to modify a blip that\n does not exist in the current context, you might specify the wave, wavelet\n and blip id to generate an operation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L125_C2", "label": "_next_operation_id =", "type": "assigned_variable", "loc": [125, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [14, 1, 0.2983, 0.0024, 1, 0.8, 0.04, 881, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "_next_operation_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _next_operation_id = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "label": "__init__", "type": "function", "loc": [127, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.3067, 0.0095, 1, 0.8, 0.08, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "proxy_for_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, proxy_for_id=None):\n self.__pending = []\n self._capability_hash = 0\n self._proxy_for_id = proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L128_C4", "label": "self.__pending =", "type": "assigned_variable", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "vector": [14, 2, 0.3055, 0.0024, 2, 0.59, 0.0, 111, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L129_C4", "label": "self._capability_hash =", "type": "assigned_variable", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "vector": [14, 2, 0.3079, 0.0024, 2, 0.59, 0.5, 684, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "self._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._capability_hash = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L130_C4", "label": "self._proxy_for_id =", "type": "assigned_variable", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "vector": [14, 2, 0.3103, 0.0024, 2, 0.59, 1.0, 288, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._proxy_for_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._proxy_for_id = proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "label": "_new_blipdata", "type": "function", "loc": [132, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.3258, 0.0239, 1, 0.8, 0.12, 656, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "_new_blipdata", "arg_names": ["self", "wave_id", "wavelet_id", "initial_content", "parent_blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _new_blipdata(self, wave_id, wavelet_id, initial_content='',\n parent_blip_id=None):\n \"\"\"Creates JSON of the blip used for this session.\"\"\"\n temp_blip_id = 'TBD_%s_%s' % (wavelet_id,\n hex(random.randint(0, sys.maxint)))\n return {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'blipId': temp_blip_id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L134_C4", "label": "expression", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "vector": [8, 2, 0.3198, 0.0024, 2, 0.12, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates JSON of the blip used for this session.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L135_C4", "label": "temp_blip_id =", "type": "assigned_variable", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "vector": [14, 2, 0.3234, 0.0048, 2, 0.12, 0.5, 823, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "temp_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp_blip_id = 'TBD_%s_%s' % (wavelet_id,\n hex(random.randint(0, sys.maxint)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L137_C4", "label": "return", "type": "return", "loc": [137, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "vector": [13, 2, 0.3317, 0.0119, 2, 0.12, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'blipId': temp_blip_id,\n 'content': initial_content,\n 'parentBlipId': parent_blip_id}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "label": "_new_waveletdata", "type": "function", "loc": [143, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.3616, 0.043, 1, 0.8, 0.16, 138, 0, 3, 1, 0, 0, 0, 4], "semantic": {"name": "_new_waveletdata", "arg_names": ["self", "domain", "participants"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _new_waveletdata(self, domain, participants):\n \"\"\"Creates an ephemeral WaveletData instance used for this session.\n\n Args:\n domain: the domain to create the data for.\n participants initially on the wavelet\n Returns:\n Blipdata (for the rootblip), WaveletData."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L144_C4", "label": "expression", "type": "expression", "loc": [144, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [8, 2, 0.352, 0.0191, 2, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates an ephemeral WaveletData instance used for this session.\n\n Args:\n domain: the domain to create the data for.\n participants initially on the wavelet\n Returns:\n Blipdata (for the rootblip), WaveletData.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L152_C4", "label": "wave_id =", "type": "assigned_variable", "loc": [152, 152], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [14, 2, 0.3628, 0.0024, 2, 0.91, 0.1667, 347, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "wave_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wave_id = domain + '!TBD_%s' % hex(random.randint(0, sys.maxint))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L153_C4", "label": "wavelet_id =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [14, 2, 0.3652, 0.0024, 2, 0.91, 0.3333, 269, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "wavelet_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet_id = domain + '!conv+root'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L154_C4", "label": "root_blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [14, 2, 0.3675, 0.0024, 2, 0.91, 0.5, 28, 3, 2, 0, 0, 656, 10, 1], "semantic": {"name": "root_blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " root_blip_data = self._new_blipdata(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L155_C4", "label": "participants = set()", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [14, 2, 0.3699, 0.0024, 2, 0.91, 0.6667, 572, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "participants", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " participants = set(participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L156_C4", "label": "wavelet_data =", "type": "assigned_variable", "loc": [156, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [14, 2, 0.3759, 0.0095, 2, 0.91, 0.8333, 467, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "wavelet_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wavelet_data = {'waveId': wave_id,\n 'waveletId': wavelet_id,\n 'rootBlipId': root_blip_data['blipId'],\n 'participants': participants}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L160_C4", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "vector": [13, 2, 0.3819, 0.0024, 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 root_blip_data, wavelet_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L162_C2", "label": "__len__", "type": "function", "loc": [162, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.3878, 0.0048, 1, 0.8, 0.2, 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 return len(self.__pending)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L163_C4", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L162_C2", "vector": [13, 2, 0.389, 0.0024, 2, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self.__pending)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L165_C2", "label": "__iter__", "type": "function", "loc": [165, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.395, 0.0048, 1, 0.8, 0.24, 891, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n return self.__pending.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L166_C4", "label": "return", "type": "return", "loc": [166, 166], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L165_C2", "vector": [13, 2, 0.3962, 0.0024, 2, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__pending.__iter__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L168_C2", "label": "clear", "type": "function", "loc": [168, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4021, 0.0048, 1, 0.8, 0.28, 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 self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L169_C4", "label": "self.__pending =", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L168_C2", "vector": [14, 2, 0.4033, 0.0024, 2, 0.59, 0.0, 111, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__pending = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "label": "proxy_for", "type": "function", "loc": [171, 182], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4212, 0.0286, 1, 0.8, 0.32, 365, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "proxy_for", "arg_names": ["self", "proxy"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def proxy_for(self, proxy):\n \"\"\"Return a view of this operation queue with the proxying for set to proxy.\n\n This method returns a new instance of an operation queue that shares the\n operation list, but has a different proxying_for_id set so the robot using\n this new queue will send out operations with the proxying_for field set.\n \"\"\"\n res = OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L172_C4", "label": "expression", "type": "expression", "loc": [172, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [8, 2, 0.4165, 0.0143, 2, 0.03, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a view of this operation queue with the proxying for set to proxy.\n\n This method returns a new instance of an operation queue that shares the\n operation list, but has a different proxying_for_id set so the robot using\n this new queue will send out operations with the proxying_for field set.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L178_C4", "label": "res = OperationQueue()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [14, 2, 0.4248, 0.0024, 2, 0.03, 0.2, 413, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " res = OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L179_C4", "label": "res.__pending =", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [14, 2, 0.4272, 0.0024, 2, 0.03, 0.4, 370, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res.__pending", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res.__pending = self.__pending"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L180_C4", "label": "res._capability_hash =", "type": "assigned_variable", "loc": [180, 180], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [14, 2, 0.4296, 0.0024, 2, 0.03, 0.6, 60, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._capability_hash = self._capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L181_C4", "label": "res._proxy_for_id =", "type": "assigned_variable", "loc": [181, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [14, 2, 0.432, 0.0024, 2, 0.03, 0.8, 985, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "res._proxy_for_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res._proxy_for_id = proxy"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L182_C4", "label": "return", "type": "return", "loc": [182, 182], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "vector": [13, 2, 0.4344, 0.0024, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L184_C2", "label": "set_capability_hash", "type": "function", "loc": [184, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4403, 0.0048, 1, 0.8, 0.36, 954, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_capability_hash", "arg_names": ["self", "capability_hash"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_capability_hash(self, capability_hash):\n self._capability_hash = capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L185_C4", "label": "self._capability_hash =", "type": "assigned_variable", "loc": [185, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L184_C2", "vector": [14, 2, 0.4415, 0.0024, 2, 0.48, 0.0, 684, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._capability_hash = capability_hash"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "label": "serialize", "type": "function", "loc": [187, 194], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4547, 0.0191, 1, 0.8, 0.4, 50, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "serialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def serialize(self):\n first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,\n '0',\n {'capabilitiesHash': self._capability_hash,\n 'protocolVersion': PROTOCOL_VERSION})\n operations = [first] + self.__pending\n res = util.serialize(operations)\n return res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L188_C4", "label": "first = Operation()", "type": "assigned_variable", "loc": [188, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "vector": [14, 2, 0.4523, 0.0095, 2, 0.34, 0.0, 199, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " first = Operation(ROBOT_NOTIFY_CAPABILITIES_HASH,\n '0',\n {'capabilitiesHash': self._capability_hash,\n 'protocolVersion': PROTOCOL_VERSION})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L192_C4", "label": "operations =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "vector": [14, 2, 0.4582, 0.0024, 2, 0.34, 0.3333, 962, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "operations", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " operations = [first] + self.__pending"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L193_C4", "label": "res = serialize()", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "vector": [14, 2, 0.4606, 0.0024, 2, 0.34, 0.6667, 413, 3, 1, 0, 0, 50, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " res = util.serialize(operations)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L194_C4", "label": "return", "type": "return", "loc": [194, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "vector": [13, 2, 0.463, 0.0024, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2", "label": "copy_operations", "type": "function", "loc": [196, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4714, 0.0095, 1, 0.8, 0.44, 938, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "copy_operations", "arg_names": ["self", "other_queue"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def copy_operations(self, other_queue):\n \"\"\"Copy the pending operations from other_queue into this one.\"\"\"\n for op in other_queue:\n self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L197_C4", "label": "expression", "type": "expression", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2", "vector": [8, 2, 0.4702, 0.0024, 2, 0.79, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Copy the pending operations from other_queue into this one.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:For_L198_C4", "label": "for op", "type": "for", "loc": [198, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2", "vector": [6, 2, 0.4737, 0.0048, 2, 0.79, 1.0, 316, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for op in other_queue:\n self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L199_C6", "label": "append()", "type": "expression", "loc": [199, 199], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:For_L198_C4", "vector": [8, 3, 0.4749, 0.0024, 3, 0.61, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.__pending.append(op)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "label": "new_operation", "type": "function", "loc": [201, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.4964, 0.0358, 1, 0.8, 0.48, 661, 0, 6, 1, 0, 0, 0, 3], "semantic": {"name": "new_operation", "arg_names": ["self", "method", "wave_id", "wavelet_id", "props", "kwprops"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def new_operation(self, method, wave_id, wavelet_id, props=None, **kwprops):\n \"\"\"Creates and adds a new operation to the operation list.\"\"\"\n if props is None:\n props = {}\n props.update(kwprops)\n props['waveId'] = wave_id\n props['waveletId'] = wavelet_id\n if self._proxy_for_id:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L202_C4", "label": "expression", "type": "expression", "loc": [202, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [8, 2, 0.4821, 0.0024, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates and adds a new operation to the operation list.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L203_C4", "label": "if", "type": "if", "loc": [203, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [4, 2, 0.4857, 0.0048, 2, 0.23, 0.125, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if props is None:\n props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L204_C6", "label": "props =", "type": "assigned_variable", "loc": [204, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L203_C4", "vector": [14, 3, 0.4869, 0.0024, 3, 0.64, 0.0, 675, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "props", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L205_C4", "label": "update()", "type": "expression", "loc": [205, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [8, 2, 0.4893, 0.0024, 2, 0.23, 0.25, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " props.update(kwprops)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L206_C4", "label": "assign", "type": "assigned_variable", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [14, 2, 0.4916, 0.0024, 2, 0.23, 0.375, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['waveId'] = wave_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L207_C4", "label": "assign", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [14, 2, 0.494, 0.0024, 2, 0.23, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['waveletId'] = wavelet_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L208_C4", "label": "if", "type": "if", "loc": [208, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [4, 2, 0.4976, 0.0048, 2, 0.23, 0.625, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._proxy_for_id:\n props['proxyingFor'] = self._proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L209_C6", "label": "assign", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L208_C4", "vector": [14, 3, 0.4988, 0.0024, 3, 0.9, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " props['proxyingFor'] = self._proxy_for_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L210_C4", "label": "operation = Operation()", "type": "assigned_variable", "loc": [210, 212], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [14, 2, 0.5036, 0.0072, 2, 0.23, 0.75, 870, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "operation", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " operation = Operation(method,\n 'op%s' % OperationQueue._next_operation_id,\n props)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L213_C4", "label": "append()", "type": "expression", "loc": [213, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [8, 2, 0.5084, 0.0024, 2, 0.23, 0.875, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.__pending.append(operation)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L215_C4", "label": "return", "type": "return", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "vector": [13, 2, 0.5131, 0.0024, 2, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return operation"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "label": "wavelet_append_blip", "type": "function", "loc": [217, 231], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.5346, 0.0358, 1, 0.8, 0.52, 420, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "wavelet_append_blip", "arg_names": ["self", "wave_id", "wavelet_id", "initial_content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_append_blip(self, wave_id, wavelet_id, initial_content=''):\n \"\"\"Appends a blip to a wavelet.\n\n Args:\n wave_id: The wave id owning the containing wavelet.\n wavelet_id: The wavelet id that this blip should be appended to.\n initial_content: optionally the content to start with\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L218_C4", "label": "expression", "type": "expression", "loc": [218, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "vector": [8, 2, 0.531, 0.0239, 2, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends a blip to a wavelet.\n\n Args:\n wave_id: The wave id owning the containing wavelet.\n wavelet_id: The wavelet id that this blip should be appended to.\n initial_content: optionally the content to start with\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L228_C4", "label": "blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "vector": [14, 2, 0.5442, 0.0024, 2, 0.23, 0.3333, 892, 3, 3, 0, 0, 656, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " blip_data = self._new_blipdata(wave_id, wavelet_id, initial_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L229_C4", "label": "new_operation()", "type": "expression", "loc": [229, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "vector": [8, 2, 0.5477, 0.0048, 2, 0.23, 0.6667, 661, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(WAVELET_APPEND_BLIP, wave_id,\n wavelet_id, blipData=blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L231_C4", "label": "return", "type": "return", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "vector": [13, 2, 0.5513, 0.0024, 2, 0.23, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blip_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2", "label": "wavelet_add_participant", "type": "function", "loc": [233, 245], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.5704, 0.031, 1, 0.8, 0.56, 945, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_add_participant", "arg_names": ["self", "wave_id", "wavelet_id", "participant_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_add_participant(self, wave_id, wavelet_id, participant_id):\n \"\"\"Adds a participant to a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L234_C4", "label": "expression", "type": "expression", "loc": [234, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2", "vector": [8, 2, 0.5692, 0.0239, 2, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Adds a participant to a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L244_C4", "label": "return", "type": "return", "loc": [244, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2", "vector": [13, 2, 0.5835, 0.0048, 2, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.new_operation(WAVELET_ADD_PARTICIPANT, wave_id, wavelet_id,\n participantId=participant_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2", "label": "wavelet_datadoc_set", "type": "function", "loc": [247, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.6038, 0.031, 1, 0.8, 0.6, 590, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_datadoc_set", "arg_names": ["self", "wave_id", "wavelet_id", "name", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_datadoc_set(self, wave_id, wavelet_id, name, data):\n \"\"\"Sets a key/value pair on the data document of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n name: The key name for this data.\n data: The value of the data to set."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L248_C4", "label": "expression", "type": "expression", "loc": [248, 257], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2", "vector": [8, 2, 0.6026, 0.0239, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets a key/value pair on the data document of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n name: The key name for this data.\n data: The value of the data to set.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L258_C4", "label": "return", "type": "return", "loc": [258, 259], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2", "vector": [13, 2, 0.6169, 0.0048, 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.new_operation(WAVELET_DATADOC_SET, wave_id, wavelet_id,\n datadocName=name, datadocValue=data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "label": "robot_create_wavelet", "type": "function", "loc": [261, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.6468, 0.0501, 1, 0.8, 0.64, 952, 0, 4, 1, 0, 0, 0, 3], "semantic": {"name": "robot_create_wavelet", "arg_names": ["self", "domain", "participants", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot_create_wavelet(self, domain, participants=None, message=''):\n \"\"\"Creates a new wavelet.\n\n Args:\n domain: the domain to create the wave in\n participants: initial participants on this wavelet or None if none\n message: an optional payload that is returned with the corresponding\n event."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L262_C4", "label": "expression", "type": "expression", "loc": [262, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [8, 2, 0.6372, 0.0263, 2, 0.38, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates a new wavelet.\n\n Args:\n domain: the domain to create the wave in\n participants: initial participants on this wavelet or None if none\n message: an optional payload that is returned with the corresponding\n event.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L273_C4", "label": "if", "type": "if", "loc": [273, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [4, 2, 0.6527, 0.0048, 2, 0.38, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if participants is None:\n participants = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L274_C6", "label": "participants =", "type": "assigned_variable", "loc": [274, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L273_C4", "vector": [14, 3, 0.6539, 0.0024, 3, 0.8, 0.0, 572, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "participants", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " participants = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L275_C4", "label": "blip_data, wavelet_data = _new_waveletdata()", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [14, 2, 0.6563, 0.0024, 2, 0.38, 0.4, 327, 3, 2, 0, 0, 138, 10, 1], "semantic": {"name": "blip_data, wavelet_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_waveletdata", "annotation": ""}, "snippet": " blip_data, wavelet_data = self._new_waveletdata(domain, participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L276_C4", "label": "op = new_operation()", "type": "assigned_variable", "loc": [276, 279], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [14, 2, 0.6623, 0.0095, 2, 0.38, 0.6, 316, 3, 4, 0, 0, 661, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " op = self.new_operation(ROBOT_CREATE_WAVELET,\n wave_id=wavelet_data['waveId'],\n wavelet_id=wavelet_data['waveletId'],\n waveletData=wavelet_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L280_C4", "label": "set_optional()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [8, 2, 0.6683, 0.0024, 2, 0.38, 0.8, 517, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_optional", "arg_names": [], "import_names": [], "rhs_call_name": "set_optional", "annotation": ""}, "snippet": " op.set_optional('message', message)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L281_C4", "label": "return", "type": "return", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "vector": [13, 2, 0.6706, 0.0024, 2, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blip_data, wavelet_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2", "label": "robot_fetch_wave", "type": "function", "loc": [283, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.6862, 0.0239, 1, 0.8, 0.68, 624, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "robot_fetch_wave", "arg_names": ["self", "wave_id", "wavelet_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def robot_fetch_wave(self, wave_id, wavelet_id):\n \"\"\"Requests a snapshot of the specified wave.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L284_C4", "label": "expression", "type": "expression", "loc": [284, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2", "vector": [8, 2, 0.6862, 0.0191, 2, 0.18, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Requests a snapshot of the specified wave.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n Returns:\n The operation created.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L292_C4", "label": "return", "type": "return", "loc": [292, 292], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2", "vector": [13, 2, 0.6969, 0.0024, 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.new_operation(ROBOT_FETCH_WAVE, wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2", "label": "wavelet_set_title", "type": "function", "loc": [294, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.7148, 0.0286, 1, 0.8, 0.72, 132, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_set_title", "arg_names": ["self", "wave_id", "wavelet_id", "title"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_set_title(self, wave_id, wavelet_id, title):\n \"\"\"Sets the title of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n title: The title to set.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L295_C4", "label": "expression", "type": "expression", "loc": [295, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2", "vector": [8, 2, 0.7136, 0.0215, 2, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Sets the title of a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n title: The title to set.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L304_C4", "label": "return", "type": "return", "loc": [304, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2", "vector": [13, 2, 0.7267, 0.0048, 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 self.new_operation(WAVELET_SET_TITLE, wave_id, wavelet_id,\n waveletTitle=title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2", "label": "wavelet_modify_participant_role", "type": "function", "loc": [307, 322], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.7506, 0.0382, 1, 0.8, 0.76, 163, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "wavelet_modify_participant_role", "arg_names": ["self", "wave_id", "wavelet_id", "participant_id", "role"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_modify_participant_role(\n self, wave_id, wavelet_id, participant_id, role):\n \"\"\"Modify the role of a participant on a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L309_C4", "label": "expression", "type": "expression", "loc": [309, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2", "vector": [8, 2, 0.7494, 0.0263, 2, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Modify the role of a participant on a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n participant_id: Id of the participant to add.\n role: the new roles\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L320_C4", "label": "return", "type": "return", "loc": [320, 322], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2", "vector": [13, 2, 0.7661, 0.0072, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.new_operation(WAVELET_MODIFY_PARTICIPANT_ROLE, wave_id, \n wavelet_id, participantId=participant_id,\n participantRole=role)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2", "label": "wavelet_modify_tag", "type": "function", "loc": [324, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.79, 0.0358, 1, 0.8, 0.8, 271, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "wavelet_modify_tag", "arg_names": ["self", "wave_id", "wavelet_id", "tag", "modify_how"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def wavelet_modify_tag(self, wave_id, wavelet_id, tag, modify_how=None):\n \"\"\"Modifies a tag in a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n tag: The tag (a string).\n modify_how: (optional) how to apply the tag. The default is to add"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L325_C4", "label": "expression", "type": "expression", "loc": [325, 336], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2", "vector": [8, 2, 0.7888, 0.0286, 2, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Modifies a tag in a wavelet.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n tag: The tag (a string).\n modify_how: (optional) how to apply the tag. The default is to add\n the tag. Specify 'remove' to remove. Specify None or 'add' to"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L337_C4", "label": "return", "type": "return", "loc": [337, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2", "vector": [13, 2, 0.8055, 0.0048, 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 self.new_operation(WAVELET_MODIFY_TAG, wave_id, wavelet_id,\n name=tag).set_optional(\"modify_how\", modify_how)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "label": "blip_create_child", "type": "function", "loc": [340, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.8294, 0.0382, 1, 0.8, 0.84, 643, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "blip_create_child", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_create_child(self, wave_id, wavelet_id, blip_id):\n \"\"\"Creates a child blip of another blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L341_C4", "label": "expression", "type": "expression", "loc": [341, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "vector": [8, 2, 0.8246, 0.0239, 2, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates a child blip of another blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L351_C4", "label": "blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [351, 351], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "vector": [14, 2, 0.8377, 0.0024, 2, 0.24, 0.3333, 892, 3, 3, 0, 0, 656, 10, 1], "semantic": {"name": "blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " blip_data = self._new_blipdata(wave_id, wavelet_id, parent_blip_id=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L352_C4", "label": "new_operation()", "type": "expression", "loc": [352, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "vector": [8, 2, 0.8425, 0.0072, 2, 0.24, 0.6667, 661, 3, 5, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(BLIP_CREATE_CHILD, wave_id, wavelet_id,\n blipId=blip_id,\n blipData=blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L355_C4", "label": "return", "type": "return", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "vector": [13, 2, 0.8473, 0.0024, 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 blip_data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2", "label": "blip_delete", "type": "function", "loc": [357, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.864, 0.0263, 1, 0.8, 0.88, 397, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "blip_delete", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def blip_delete(self, wave_id, wavelet_id, blip_id):\n \"\"\"Deletes the specified blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L358_C4", "label": "expression", "type": "expression", "loc": [358, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2", "vector": [8, 2, 0.864, 0.0215, 2, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deletes the specified blip.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n Returns:\n The operation created."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L367_C4", "label": "return", "type": "return", "loc": [367, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2", "vector": [13, 2, 0.8759, 0.0024, 2, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.new_operation(BLIP_DELETE, wave_id, wavelet_id, blipId=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2", "label": "document_append_markup", "type": "function", "loc": [369, 381], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.895, 0.031, 1, 0.8, 0.92, 684, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "document_append_markup", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id", "content"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_append_markup(self, wave_id, wavelet_id, blip_id, content):\n \"\"\"Appends content with markup to a document.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n content: The markup content to append."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L370_C4", "label": "expression", "type": "expression", "loc": [370, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2", "vector": [8, 2, 0.8938, 0.0239, 2, 0.07, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Appends content with markup to a document.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n content: The markup content to append.\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L380_C4", "label": "return", "type": "return", "loc": [380, 381], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2", "vector": [13, 2, 0.9081, 0.0048, 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.new_operation(DOCUMENT_APPEND_MARKUP, wave_id, wavelet_id,\n blipId=blip_id, content=content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2", "label": "document_modify", "type": "function", "loc": [383, 399], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.9332, 0.0406, 1, 0.8, 0.96, 155, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "document_modify", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_modify(self, wave_id, wavelet_id, blip_id):\n \"\"\"Creates and queues a document modify operation\n\n The returned operation still needs to be filled with details before\n it makes sense.\n\n Args:\n wave_id: The wave id owning that this operation is applied to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L384_C4", "label": "expression", "type": "expression", "loc": [384, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2", "vector": [8, 2, 0.9296, 0.0286, 2, 0.32, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Creates and queues a document modify operation\n\n The returned operation still needs to be filled with details before\n it makes sense.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L396_C4", "label": "return", "type": "return", "loc": [396, 399], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2", "vector": [13, 2, 0.9487, 0.0095, 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.new_operation(DOCUMENT_MODIFY,\n wave_id,\n wavelet_id,\n blipId=blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "label": "document_inline_blip_insert", "type": "function", "loc": [401, 419], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "vector": [2, 1, 0.9785, 0.0453, 1, 0.8, 1.0, 243, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "document_inline_blip_insert", "arg_names": ["self", "wave_id", "wavelet_id", "blip_id", "position"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def document_inline_blip_insert(self, wave_id, wavelet_id, blip_id, position):\n \"\"\"Inserts an inline blip at a specific location.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n position: The position in the document to insert the blip."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L402_C4", "label": "expression", "type": "expression", "loc": [402, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "vector": [8, 2, 0.9714, 0.0263, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inserts an inline blip at a specific location.\n\n Args:\n wave_id: The wave id owning that this operation is applied to.\n wavelet_id: The wavelet id that this operation is applied to.\n blip_id: The blip id that this operation is applied to.\n position: The position in the document to insert the blip.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L413_C4", "label": "inline_blip_data = _new_blipdata()", "type": "assigned_variable", "loc": [413, 413], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "vector": [14, 2, 0.9857, 0.0024, 2, 0.98, 0.25, 573, 3, 2, 0, 0, 656, 10, 1], "semantic": {"name": "inline_blip_data", "arg_names": [], "import_names": [], "rhs_call_name": "_new_blipdata", "annotation": ""}, "snippet": " inline_blip_data = self._new_blipdata(wave_id, wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L414_C4", "label": "assign", "type": "assigned_variable", "loc": [414, 414], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "vector": [14, 2, 0.9881, 0.0024, 2, 0.98, 0.5, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " inline_blip_data['parentBlipId'] = blip_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L415_C4", "label": "new_operation()", "type": "expression", "loc": [415, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "vector": [8, 2, 0.994, 0.0095, 2, 0.98, 0.75, 661, 3, 6, 0, 0, 0, 0, 1], "semantic": {"name": "new_operation", "arg_names": [], "import_names": [], "rhs_call_name": "new_operation", "annotation": ""}, "snippet": " self.new_operation(DOCUMENT_INLINE_BLIP_INSERT, wave_id, wavelet_id,\n blipId=blip_id,\n index=position,\n blipData=inline_blip_data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L419_C4", "label": "return", "type": "return", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "vector": [13, 2, 1.0, 0.0024, 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 inline_blip_data"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L128_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L127_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L156_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L162_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L162_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L165_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L165_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L168_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L178_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L180_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L171_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L182_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L184_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L184_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L187_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L197_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L196_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:For_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:For_L198_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L199_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L203_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L203_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L204_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L205_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L208_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L209_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L213_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L201_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L218_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L229_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L217_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L234_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L233_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L244_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L248_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L247_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L258_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L273_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:If_L273_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L274_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L275_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L276_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L292_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L304_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L309_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L320_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L337_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L341_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L352_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L340_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L384_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L383_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L396_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:ClassDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L402_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L413_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Assign_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Expr_L415_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1140:FunctionDef_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1140:Return_L419_C4"}] |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc. All Rights Reserved.
"""Tests for google3.walkabout.externalagents.api.commandline_robot_runner."""
__author__ = 'douwe@google.com (Douwe Osinga)'
import StringIO
from google3.pyglib import app
from google3.pyglib import flags
from google3.testing.pybase import googletest
from google3.walkabout.externalagents.api import commandline_robot_runner
from google3.walkabout.externalagents.api import events
FLAGS = flags.FLAGS
BLIP_JSON = ('{"wdykLROk*13":'
'{"lastModifiedTime":1242079608457,'
'"contributors":["someguy@test.com"],'
'"waveletId":"test.com!conv+root",'
'"waveId":"test.com!wdykLROk*11",'
'"parentBlipId":null,'
'"version":3,'
'"creator":"someguy@test.com",'
'"content":"\\nContent!",'
'"blipId":"wdykLROk*13",'
'"annotations":[{"range":{"start":0,"end":1},'
'"name":"user/e/otherguy@test.com","value":"Other"}],'
'"elements":{},'
'"childBlipIds":[]}'
'}')
WAVELET_JSON = ('{"lastModifiedTime":1242079611003,'
'"title":"A title",'
'"waveletId":"test.com!conv+root",'
'"rootBlipId":"wdykLROk*13",'
'"dataDocuments":null,'
'"creationTime":1242079608457,'
'"waveId":"test.com!wdykLROk*11",'
'"participants":["someguy@test.com","monty@appspot.com"],'
'"creator":"someguy@test.com",'
'"version":5}')
EVENTS_JSON = ('[{"timestamp":1242079611003,'
'"modifiedBy":"someguy@test.com",'
'"properties":{"participantsRemoved":[],'
'"participantsAdded":["monty@appspot.com"]},'
'"type":"WAVELET_PARTICIPANTS_CHANGED"}]')
TEST_JSON = '{"blips":%s,"wavelet":%s,"events":%s}' % (
BLIP_JSON, WAVELET_JSON, EVENTS_JSON)
class CommandlineRobotRunnerTest(googletest.TestCase):
def testSimpleFlow(self):
FLAGS.eventdef_wavelet_participants_changed = 'x'
flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()
setattr(FLAGS, flag, 'w.title="New title!"')
input_stream = StringIO.StringIO(TEST_JSON)
output_stream = StringIO.StringIO()
commandline_robot_runner.run_bot(input_stream, output_stream)
res = output_stream.getvalue()
self.assertTrue('wavelet.setTitle' in res)
def main(unused_argv):
googletest.main()
if __name__ == '__main__':
app.run()
| ajibawa-2023/Python-Code-Large/train/row_1141 | 27 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L5_C0", "label": "expression", "type": "expression", "loc": [5, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0658, 0.0132, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Tests for google3.walkabout.externalagents.api.commandline_robot_runner.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L7_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0921, 0.0132, 0, 0.66, 0.0667, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'douwe@google.com (Douwe Osinga)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Import_L9_C0", "label": "StringIO import StringIO", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1184, 0.0132, 0, 0.66, 0.1333, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": "import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ImportFrom_L11_C0", "label": "from google3.pyglib import app", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1447, 0.0132, 0, 0.66, 0.2, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ImportFrom_L12_C0", "label": "from google3.pyglib import flags", "type": "import", "loc": [12, 12], "level": 0, "parent": null, "vector": [1, 0, 0.1579, 0.0132, 0, 0.66, 0.2667, 396, 0, 1, 0, 0, 396, 0, 0], "semantic": {"name": "google3.pyglib", "arg_names": [], "import_names": ["flags"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.pyglib import flags"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ImportFrom_L14_C0", "label": "from google3.testing.pybase import googletest", "type": "import", "loc": [14, 14], "level": 0, "parent": null, "vector": [1, 0, 0.1842, 0.0132, 0, 0.66, 0.3333, 796, 0, 1, 0, 0, 796, 0, 0], "semantic": {"name": "google3.testing.pybase", "arg_names": [], "import_names": ["googletest"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.testing.pybase import googletest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ImportFrom_L15_C0", "label": "from google3.walkabout.externalagents.api import commandline_robot_runner", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.1974, 0.0132, 0, 0.66, 0.4, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["commandline_robot_runner"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import commandline_robot_runner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ImportFrom_L16_C0", "label": "from google3.walkabout.externalagents.api import events", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.2105, 0.0132, 0, 0.66, 0.4667, 411, 0, 1, 0, 0, 411, 0, 0], "semantic": {"name": "google3.walkabout.externalagents.api", "arg_names": [], "import_names": ["events"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google3.walkabout.externalagents.api import events"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L18_C0", "label": "FLAGS =", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.2368, 0.0132, 0, 0.66, 0.5333, 578, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLAGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLAGS = flags.FLAGS"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L21_C0", "label": "BLIP_JSON =", "type": "assigned_variable", "loc": [21, 35], "level": 0, "parent": null, "vector": [14, 0, 0.3684, 0.1974, 0, 0.66, 0.6, 809, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BLIP_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BLIP_JSON = ('{\"wdykLROk*13\":'\n '{\"lastModifiedTime\":1242079608457,'\n '\"contributors\":[\"someguy@test.com\"],'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"parentBlipId\":null,'\n '\"version\":3,'\n '\"creator\":\"someguy@test.com\",'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L37_C0", "label": "WAVELET_JSON =", "type": "assigned_variable", "loc": [37, 46], "level": 0, "parent": null, "vector": [14, 0, 0.5461, 0.1316, 0, 0.66, 0.6667, 26, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "WAVELET_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "WAVELET_JSON = ('{\"lastModifiedTime\":1242079611003,'\n '\"title\":\"A title\",'\n '\"waveletId\":\"test.com!conv+root\",'\n '\"rootBlipId\":\"wdykLROk*13\",'\n '\"dataDocuments\":null,'\n '\"creationTime\":1242079608457,'\n '\"waveId\":\"test.com!wdykLROk*11\",'\n '\"participants\":[\"someguy@test.com\",\"monty@appspot.com\"],'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L48_C0", "label": "EVENTS_JSON =", "type": "assigned_variable", "loc": [48, 52], "level": 0, "parent": null, "vector": [14, 0, 0.6579, 0.0658, 0, 0.66, 0.7333, 859, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "EVENTS_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EVENTS_JSON = ('[{\"timestamp\":1242079611003,'\n '\"modifiedBy\":\"someguy@test.com\",'\n '\"properties\":{\"participantsRemoved\":[],'\n '\"participantsAdded\":[\"monty@appspot.com\"]},'\n '\"type\":\"WAVELET_PARTICIPANTS_CHANGED\"}]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L54_C0", "label": "TEST_JSON =", "type": "assigned_variable", "loc": [54, 55], "level": 0, "parent": null, "vector": [14, 0, 0.7171, 0.0263, 0, 0.66, 0.8, 23, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEST_JSON", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_JSON = '{\"blips\":%s,\"wavelet\":%s,\"events\":%s}' % (\n BLIP_JSON, WAVELET_JSON, EVENTS_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:ClassDef_L58_C0", "label": "CommandlineRobotRunnerTest", "type": "class", "loc": [58, 68], "level": 0, "parent": null, "vector": [3, 0, 0.8289, 0.1447, 0, 0.66, 0.8667, 632, 0, 1, 0, 0, 445, 0, 7], "semantic": {"name": "CommandlineRobotRunnerTest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class CommandlineRobotRunnerTest(googletest.TestCase):\n\n def testSimpleFlow(self):\n FLAGS.eventdef_wavelet_participants_changed = 'x'\n flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()\n setattr(FLAGS, flag, 'w.title=\"New title!\"')\n input_stream = StringIO.StringIO(TEST_JSON)\n output_stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "label": "testSimpleFlow", "type": "function", "loc": [60, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:ClassDef_L58_C0", "vector": [2, 1, 0.8421, 0.1184, 1, 0.41, 0.0, 976, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testSimpleFlow", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSimpleFlow(self):\n FLAGS.eventdef_wavelet_participants_changed = 'x'\n flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()\n setattr(FLAGS, flag, 'w.title=\"New title!\"')\n input_stream = StringIO.StringIO(TEST_JSON)\n output_stream = StringIO.StringIO()\n commandline_robot_runner.run_bot(input_stream, output_stream)\n res = output_stream.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L61_C4", "label": "FLAGS.eventdef_wavelet_participants_changed =", "type": "assigned_variable", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [14, 2, 0.8026, 0.0132, 2, 0.93, 0.0, 249, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "FLAGS.eventdef_wavelet_participants_changed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " FLAGS.eventdef_wavelet_participants_changed = 'x'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L62_C4", "label": "flag =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [14, 2, 0.8158, 0.0132, 2, 0.93, 0.1429, 756, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "flag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " flag = 'eventdef_' + events.WaveletParticipantsChanged.type.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L63_C4", "label": "setattr()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [8, 2, 0.8289, 0.0132, 2, 0.93, 0.2857, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(FLAGS, flag, 'w.title=\"New title!\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L64_C4", "label": "input_stream = StringIO()", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [14, 2, 0.8421, 0.0132, 2, 0.93, 0.4286, 122, 3, 1, 0, 0, 609, 10, 1], "semantic": {"name": "input_stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " input_stream = StringIO.StringIO(TEST_JSON)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L65_C4", "label": "output_stream = StringIO()", "type": "assigned_variable", "loc": [65, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [14, 2, 0.8553, 0.0132, 2, 0.93, 0.5714, 354, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "output_stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " output_stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L66_C4", "label": "run_bot()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [8, 2, 0.8684, 0.0132, 2, 0.93, 0.7143, 707, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "run_bot", "arg_names": [], "import_names": [], "rhs_call_name": "run_bot", "annotation": ""}, "snippet": " commandline_robot_runner.run_bot(input_stream, output_stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L67_C4", "label": "res = getvalue()", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [14, 2, 0.8816, 0.0132, 2, 0.93, 0.8571, 413, 3, 0, 0, 0, 626, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "getvalue", "annotation": ""}, "snippet": " res = output_stream.getvalue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L68_C4", "label": "assertTrue()", "type": "expression", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "vector": [8, 2, 0.8947, 0.0132, 2, 0.93, 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('wavelet.setTitle' in res)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L71_C0", "label": "main", "type": "function", "loc": [71, 72], "level": 0, "parent": null, "vector": [2, 0, 0.9408, 0.0263, 0, 0.66, 0.9333, 624, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": ["unused_argv"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main(unused_argv):\n googletest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L71_C0", "vector": [8, 1, 0.9474, 0.0132, 1, 0.7, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " googletest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:If_L75_C0", "label": "if", "type": "if", "loc": [75, 76], "level": 0, "parent": null, "vector": [4, 0, 0.9934, 0.0263, 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 app.run()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L76_C2", "label": "run()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1141:If_L75_C0", "vector": [8, 1, 1.0, 0.0132, 1, 0.65, 0.0, 679, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " app.run()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1141:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:FunctionDef_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1141:If_L75_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1141:Expr_L76_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the ops module."""
import unittest
import ops
class TestOperation(unittest.TestCase):
"""Test case for Operation class."""
def testFields(self):
op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',
{'waveId': 'wavelet-id',
'title': 'a title'})
self.assertEqual(ops.WAVELET_SET_TITLE, op.method)
self.assertEqual('opid02', op.id)
self.assertEqual(2, len(op.params))
def testConstructModifyTag(self):
q = ops.OperationQueue()
op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')
self.assertEqual(3, len(op.params))
op = q.wavelet_modify_tag(
'waveid', 'waveletid', 'tag', modify_how='remove')
self.assertEqual(4, len(op.params))
def testConstructRobotFetchWave(self):
q = ops.OperationQueue('proxyid')
op = q.robot_fetch_wave('wave1', 'wavelet1')
self.assertEqual(3, len(op.params))
self.assertEqual('proxyid', op.params['proxyingFor'])
self.assertEqual('wave1', op.params['waveId'])
self.assertEqual('wavelet1', op.params['waveletId'])
class TestOperationQueue(unittest.TestCase):
"""Test case for OperationQueue class."""
def testSerialize(self):
q = ops.OperationQueue()
q.set_capability_hash('hash')
op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')
json = q.serialize()
self.assertEqual(2, len(json))
self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])
self.assertEqual('hash', json[0]['params']['capabilitiesHash'])
self.assertEqual(ops.PROTOCOL_VERSION, json[0]['params']['protocolVersion'])
self.assertEqual('wavelet.modifyTag', json[1]['method'])
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1142 | 37 | 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_1142:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2537, 0.0149, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the ops module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.2985, 0.0149, 0, 0.66, 0.2, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Import_L22_C0", "label": "ops import ops", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.3284, 0.0149, 0, 0.66, 0.4, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "label": "TestOperation", "type": "class", "loc": [25, 50], "level": 0, "parent": null, "vector": [3, 0, 0.5597, 0.3881, 0, 0.66, 0.6, 303, 0, 3, 0, 0, 878, 0, 19], "semantic": {"name": "TestOperation", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestOperation(unittest.TestCase):\n \"\"\"Test case for Operation class.\"\"\"\n\n def testFields(self):\n op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})\n self.assertEqual(ops.WAVELET_SET_TITLE, op.method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L26_C2", "label": "expression", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "vector": [8, 1, 0.3881, 0.0149, 1, 0.54, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Test case for Operation class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "label": "testFields", "type": "function", "loc": [28, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "vector": [2, 1, 0.4627, 0.1045, 1, 0.54, 0.3333, 759, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testFields", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testFields(self):\n op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})\n self.assertEqual(ops.WAVELET_SET_TITLE, op.method)\n self.assertEqual('opid02', op.id)\n self.assertEqual(2, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L29_C4", "label": "op = Operation()", "type": "assigned_variable", "loc": [29, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "vector": [14, 2, 0.4478, 0.0448, 2, 0.61, 0.0, 316, 3, 3, 0, 0, 222, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "Operation", "annotation": ""}, "snippet": " op = ops.Operation(ops.WAVELET_SET_TITLE, 'opid02',\n {'waveId': 'wavelet-id',\n 'title': 'a title'})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L32_C4", "label": "assertEqual()", "type": "expression", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "vector": [8, 2, 0.4776, 0.0149, 2, 0.61, 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(ops.WAVELET_SET_TITLE, op.method)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L33_C4", "label": "assertEqual()", "type": "expression", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "vector": [8, 2, 0.4925, 0.0149, 2, 0.61, 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('opid02', op.id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L34_C4", "label": "assertEqual()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "vector": [8, 2, 0.5075, 0.0149, 2, 0.61, 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(2, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "label": "testConstructModifyTag", "type": "function", "loc": [36, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "vector": [2, 1, 0.5821, 0.1045, 1, 0.54, 0.6667, 596, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testConstructModifyTag", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConstructModifyTag(self):\n q = ops.OperationQueue()\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n self.assertEqual(3, len(op.params))\n op = q.wavelet_modify_tag(\n 'waveid', 'waveletid', 'tag', modify_how='remove')\n self.assertEqual(4, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L37_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "vector": [14, 2, 0.5522, 0.0149, 2, 0.07, 0.0, 516, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L38_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "vector": [14, 2, 0.5672, 0.0149, 2, 0.07, 0.25, 316, 3, 3, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L39_C4", "label": "assertEqual()", "type": "expression", "loc": [39, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "vector": [8, 2, 0.5821, 0.0149, 2, 0.07, 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(3, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L40_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "vector": [14, 2, 0.6045, 0.0299, 2, 0.07, 0.75, 316, 3, 4, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag(\n 'waveid', 'waveletid', 'tag', modify_how='remove')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L42_C4", "label": "assertEqual()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "vector": [8, 2, 0.6269, 0.0149, 2, 0.07, 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(4, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "label": "testConstructRobotFetchWave", "type": "function", "loc": [44, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "vector": [2, 1, 0.7015, 0.1045, 1, 0.54, 1.0, 750, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "testConstructRobotFetchWave", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testConstructRobotFetchWave(self):\n q = ops.OperationQueue('proxyid')\n op = q.robot_fetch_wave('wave1', 'wavelet1')\n self.assertEqual(3, len(op.params))\n self.assertEqual('proxyid', op.params['proxyingFor'])\n self.assertEqual('wave1', op.params['waveId'])\n self.assertEqual('wavelet1', op.params['waveletId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L45_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [14, 2, 0.6716, 0.0149, 2, 0.65, 0.0, 516, 3, 1, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue('proxyid')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L46_C4", "label": "op = robot_fetch_wave()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [14, 2, 0.6866, 0.0149, 2, 0.65, 0.2, 316, 3, 2, 0, 0, 624, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "robot_fetch_wave", "annotation": ""}, "snippet": " op = q.robot_fetch_wave('wave1', 'wavelet1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L47_C4", "label": "assertEqual()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [8, 2, 0.7015, 0.0149, 2, 0.65, 0.4, 299, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(3, len(op.params))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L48_C4", "label": "assertEqual()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [8, 2, 0.7164, 0.0149, 2, 0.65, 0.6, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('proxyid', op.params['proxyingFor'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L49_C4", "label": "assertEqual()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [8, 2, 0.7313, 0.0149, 2, 0.65, 0.8, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('wave1', op.params['waveId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L50_C4", "label": "assertEqual()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "vector": [8, 2, 0.7463, 0.0149, 2, 0.65, 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('wavelet1', op.params['waveletId'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L52_C0", "label": "TestOperationQueue", "type": "class", "loc": [52, 64], "level": 0, "parent": null, "vector": [3, 0, 0.8657, 0.194, 0, 0.66, 0.8, 241, 0, 1, 0, 0, 878, 0, 10], "semantic": {"name": "TestOperationQueue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestOperationQueue(unittest.TestCase):\n \"\"\"Test case for OperationQueue class.\"\"\"\n\n def testSerialize(self):\n q = ops.OperationQueue()\n q.set_capability_hash('hash')\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n json = q.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L53_C2", "label": "expression", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L52_C0", "vector": [8, 1, 0.791, 0.0149, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Test case for OperationQueue class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "label": "testSerialize", "type": "function", "loc": [55, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L52_C0", "vector": [2, 1, 0.8881, 0.1493, 1, 0.78, 1.0, 465, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n q = ops.OperationQueue()\n q.set_capability_hash('hash')\n op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')\n json = q.serialize()\n self.assertEqual(2, len(json))\n self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])\n self.assertEqual('hash', json[0]['params']['capabilitiesHash'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L56_C4", "label": "q = OperationQueue()", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [14, 2, 0.8358, 0.0149, 2, 0.92, 0.0, 516, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "q", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " q = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L57_C4", "label": "set_capability_hash()", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.8507, 0.0149, 2, 0.92, 0.125, 954, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "set_capability_hash", "arg_names": [], "import_names": [], "rhs_call_name": "set_capability_hash", "annotation": ""}, "snippet": " q.set_capability_hash('hash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L58_C4", "label": "op = wavelet_modify_tag()", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [14, 2, 0.8657, 0.0149, 2, 0.92, 0.25, 316, 3, 3, 0, 0, 271, 10, 1], "semantic": {"name": "op", "arg_names": [], "import_names": [], "rhs_call_name": "wavelet_modify_tag", "annotation": ""}, "snippet": " op = q.wavelet_modify_tag('waveid', 'waveletid', 'tag')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L59_C4", "label": "json = serialize()", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [14, 2, 0.8806, 0.0149, 2, 0.92, 0.375, 463, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "json", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " json = q.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L60_C4", "label": "assertEqual()", "type": "expression", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.8955, 0.0149, 2, 0.92, 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(2, len(json))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L61_C4", "label": "assertEqual()", "type": "expression", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.9104, 0.0149, 2, 0.92, 0.625, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('robot.notifyCapabilitiesHash', json[0]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L62_C4", "label": "assertEqual()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.9254, 0.0149, 2, 0.92, 0.75, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual('hash', json[0]['params']['capabilitiesHash'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L63_C4", "label": "assertEqual()", "type": "expression", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.9403, 0.0149, 2, 0.92, 0.875, 299, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEqual", "arg_names": [], "import_names": [], "rhs_call_name": "assertEqual", "annotation": ""}, "snippet": " self.assertEqual(ops.PROTOCOL_VERSION, json[0]['params']['protocolVersion'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L64_C4", "label": "assertEqual()", "type": "expression", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "vector": [8, 2, 0.9552, 0.0149, 2, 0.92, 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('wavelet.modifyTag', json[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:If_L66_C0", "label": "if", "type": "if", "loc": [66, 67], "level": 0, "parent": null, "vector": [4, 0, 0.9925, 0.0299, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L67_C2", "label": "main()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1142:If_L66_C0", "vector": [8, 1, 1.0, 0.0149, 1, 0.59, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:ClassDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Assign_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:FunctionDef_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1142:If_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1142:Expr_L67_C2"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility library containing various helpers used by the API."""
import re
CUSTOM_SERIALIZE_METHOD_NAME = 'serialize'
MARKUP_RE = re.compile(r'<([^>]*?)>')
def force_unicode(object):
""" Return the Unicode string version of object, with UTF-8 encoding. """
if isinstance(object, unicode):
return object
return unicode(str(object), 'utf-8')
def parse_markup(markup):
"""Parses a bit of markup into robot compatible text.
For now this is a rough approximation.
"""
def replace_tag(group):
if not group.groups:
return ''
tag = group.groups()[0].split(' ', 1)[0]
if (tag == 'p' or tag == 'br'):
return '\n'
return ''
return MARKUP_RE.sub(replace_tag, markup)
def is_iterable(inst):
"""Returns whether or not this is a list, tuple, set or dict .
Note that this does not return true for strings.
"""
return hasattr(inst, '__iter__')
def is_dict(inst):
"""Returns whether or not the specified instance is a dict."""
return hasattr(inst, 'iteritems')
def is_user_defined_new_style_class(obj):
"""Returns whether or not the specified instance is a user-defined type."""
return type(obj).__module__ != '__builtin__'
def lower_camel_case(s):
"""Converts a string to lower camel case.
Examples:
foo => foo
foo_bar => fooBar
foo__bar => fooBar
foo_bar_baz => fooBarBaz
Args:
s: The string to convert to lower camel case.
Returns:
The lower camel cased string.
"""
return reduce(lambda a, b: a + (a and b.capitalize() or b), s.split('_'))
def non_none_dict(d):
"""return a copy of the dictionary without none values."""
return dict([a for a in d.items() if not a[1] is None])
def _serialize_attributes(obj):
"""Serializes attributes of an instance.
Iterates all attributes of an object and invokes serialize if they are
public and not callable.
Args:
obj: The instance to serialize.
Returns:
The serialized object.
"""
data = {}
for attr_name in dir(obj):
if attr_name.startswith('_'):
continue
attr = getattr(obj, attr_name)
if attr is None or callable(attr):
continue
# Looks okay, serialize it.
data[lower_camel_case(attr_name)] = serialize(attr)
return data
def _serialize_dict(d):
"""Invokes serialize on all of its key/value pairs.
Args:
d: The dict instance to serialize.
Returns:
The serialized dict.
"""
data = {}
for k, v in d.items():
data[lower_camel_case(k)] = serialize(v)
return data
def serialize(obj):
"""Serializes any instance.
If this is a user-defined instance
type, it will first check for a custom Serialize() function and use that
if it exists. Otherwise, it will invoke serialize all of its public
attributes. Lists and dicts are serialized trivially.
Args:
obj: The instance to serialize.
Returns:
The serialized object.
"""
if is_user_defined_new_style_class(obj):
if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):
method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)
if callable(method):
return method()
return _serialize_attributes(obj)
elif is_dict(obj):
return _serialize_dict(obj)
elif is_iterable(obj):
return [serialize(v) for v in obj]
return obj
class StringEnum(object):
"""Enum like class that is configured with a list of values.
This class effectively implements an enum for Elements, except for that
the actual values of the enums will be the string values.
"""
def __init__(self, *values):
for name in values:
setattr(self, name, name)
| ajibawa-2023/Python-Code-Large/train/row_1143 | 67 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1069, 0.0063, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Utility library containing various helpers used by the API.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Import_L19_C0", "label": "re import re", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1195, 0.0063, 0, 0.66, 0.0714, 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_1143:Assign_L21_C0", "label": "CUSTOM_SERIALIZE_METHOD_NAME =", "type": "assigned_variable", "loc": [21, 21], "level": 0, "parent": null, "vector": [14, 0, 0.1321, 0.0063, 0, 0.66, 0.1429, 6, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CUSTOM_SERIALIZE_METHOD_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "CUSTOM_SERIALIZE_METHOD_NAME = 'serialize'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L23_C0", "label": "MARKUP_RE = compile()", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1447, 0.0063, 0, 0.66, 0.2143, 885, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "MARKUP_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "MARKUP_RE = re.compile(r'<([^>]*?)>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "label": "force_unicode", "type": "function", "loc": [26, 30], "level": 0, "parent": null, "vector": [2, 0, 0.1761, 0.0314, 0, 0.66, 0.2857, 870, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "force_unicode", "arg_names": ["object"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def force_unicode(object):\n \"\"\" Return the Unicode string version of object, with UTF-8 encoding. \"\"\"\n if isinstance(object, unicode):\n return object\n return unicode(str(object), 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "vector": [8, 1, 0.1698, 0.0063, 1, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\" Return the Unicode string version of object, with UTF-8 encoding. \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L28_C2", "label": "if", "type": "if", "loc": [28, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "vector": [4, 1, 0.1792, 0.0126, 1, 0.21, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(object, unicode):\n return object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L29_C4", "label": "return", "type": "return", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L28_C2", "vector": [13, 2, 0.1824, 0.0063, 2, 0.43, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L30_C2", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "vector": [13, 1, 0.1887, 0.0063, 1, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return unicode(str(object), 'utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "label": "parse_markup", "type": "function", "loc": [32, 45], "level": 0, "parent": null, "vector": [2, 0, 0.2421, 0.0881, 0, 0.66, 0.3571, 378, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "parse_markup", "arg_names": ["markup"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def parse_markup(markup):\n \"\"\"Parses a bit of markup into robot compatible text.\n \n For now this is a rough approximation.\n \"\"\"\n def replace_tag(group):\n if not group.groups:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L33_C2", "label": "expression", "type": "expression", "loc": [33, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "vector": [8, 1, 0.217, 0.0252, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a bit of markup into robot compatible text.\n \n For now this is a rough approximation.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "label": "replace_tag", "type": "function", "loc": [37, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "vector": [2, 1, 0.2516, 0.044, 1, 0.44, 0.5, 444, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace_tag", "arg_names": ["group"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace_tag(group):\n if not group.groups:\n return ''\n tag = group.groups()[0].split(' ', 1)[0]\n if (tag == 'p' or tag == 'br'):\n return '\\n'\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L38_C4", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "vector": [4, 2, 0.2421, 0.0126, 2, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not group.groups:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L39_C6", "label": "return", "type": "return", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L38_C4", "vector": [13, 3, 0.2453, 0.0063, 3, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L40_C4", "label": "tag =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "vector": [14, 2, 0.2516, 0.0063, 2, 0.44, 0.3333, 732, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag = group.groups()[0].split(' ', 1)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "vector": [4, 2, 0.261, 0.0126, 2, 0.44, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (tag == 'p' or tag == 'br'):\n return '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L42_C6", "label": "return", "type": "return", "loc": [42, 42], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L41_C4", "vector": [13, 3, 0.2642, 0.0063, 3, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "vector": [13, 2, 0.2704, 0.0063, 2, 0.44, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "vector": [13, 1, 0.283, 0.0063, 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 MARKUP_RE.sub(replace_tag, markup)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L47_C0", "label": "is_iterable", "type": "function", "loc": [47, 52], "level": 0, "parent": null, "vector": [2, 0, 0.3113, 0.0377, 0, 0.66, 0.4286, 258, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_iterable", "arg_names": ["inst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_iterable(inst):\n \"\"\"Returns whether or not this is a list, tuple, set or dict .\n\n Note that this does not return true for strings.\n \"\"\"\n return hasattr(inst, '__iter__')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L48_C2", "label": "expression", "type": "expression", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L47_C0", "vector": [8, 1, 0.3113, 0.0252, 1, 0.29, 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 this is a list, tuple, set or dict .\n\n Note that this does not return true for strings.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L52_C2", "label": "return", "type": "return", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L47_C0", "vector": [13, 1, 0.327, 0.0063, 1, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hasattr(inst, '__iter__')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L54_C0", "label": "is_dict", "type": "function", "loc": [54, 56], "level": 0, "parent": null, "vector": [2, 0, 0.3459, 0.0189, 0, 0.66, 0.5, 59, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_dict", "arg_names": ["inst"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_dict(inst):\n \"\"\"Returns whether or not the specified instance is a dict.\"\"\"\n return hasattr(inst, 'iteritems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L54_C0", "vector": [8, 1, 0.3459, 0.0063, 1, 0.27, 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 specified instance is a dict.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L54_C0", "vector": [13, 1, 0.3522, 0.0063, 1, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return hasattr(inst, 'iteritems')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L59_C0", "label": "is_user_defined_new_style_class", "type": "function", "loc": [59, 61], "level": 0, "parent": null, "vector": [2, 0, 0.3774, 0.0189, 0, 0.66, 0.5714, 657, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "is_user_defined_new_style_class", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_user_defined_new_style_class(obj):\n \"\"\"Returns whether or not the specified instance is a user-defined type.\"\"\"\n return type(obj).__module__ != '__builtin__'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L59_C0", "vector": [8, 1, 0.3774, 0.0063, 1, 0.78, 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 specified instance is a user-defined type.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L61_C2", "label": "return", "type": "return", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L59_C0", "vector": [13, 1, 0.3836, 0.0063, 1, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return type(obj).__module__ != '__builtin__'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L63_C0", "label": "lower_camel_case", "type": "function", "loc": [63, 78], "level": 0, "parent": null, "vector": [2, 0, 0.4434, 0.1006, 0, 0.66, 0.6429, 841, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "lower_camel_case", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def lower_camel_case(s):\n \"\"\"Converts a string to lower camel case.\n\n Examples:\n foo => foo\n foo_bar => fooBar\n foo__bar => fooBar\n foo_bar_baz => fooBarBaz"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L64_C2", "label": "expression", "type": "expression", "loc": [64, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L63_C0", "vector": [8, 1, 0.4434, 0.0881, 1, 0.47, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Converts a string to lower camel case.\n\n Examples:\n foo => foo\n foo_bar => fooBar\n foo__bar => fooBar\n foo_bar_baz => fooBarBaz\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L78_C2", "label": "return", "type": "return", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L63_C0", "vector": [13, 1, 0.4906, 0.0063, 1, 0.47, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reduce(lambda a, b: a + (a and b.capitalize() or b), s.split('_'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L80_C0", "label": "non_none_dict", "type": "function", "loc": [80, 82], "level": 0, "parent": null, "vector": [2, 0, 0.5094, 0.0189, 0, 0.66, 0.7143, 666, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "non_none_dict", "arg_names": ["d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def non_none_dict(d):\n \"\"\"return a copy of the dictionary without none values.\"\"\"\n return dict([a for a in d.items() if not a[1] is None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L81_C2", "label": "expression", "type": "expression", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L80_C0", "vector": [8, 1, 0.5094, 0.0063, 1, 0.14, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"return a copy of the dictionary without none values.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L80_C0", "vector": [13, 1, 0.5157, 0.0063, 1, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict([a for a in d.items() if not a[1] is None])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "label": "_serialize_attributes", "type": "function", "loc": [84, 105], "level": 0, "parent": null, "vector": [2, 0, 0.5943, 0.1384, 0, 0.66, 0.7857, 227, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_serialize_attributes", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _serialize_attributes(obj):\n \"\"\"Serializes attributes of an instance.\n\n Iterates all attributes of an object and invokes serialize if they are\n public and not callable.\n\n Args:\n obj: The instance to serialize."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "vector": [8, 1, 0.566, 0.0692, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes attributes of an instance.\n\n Iterates all attributes of an object and invokes serialize if they are\n public and not callable.\n\n Args:\n obj: The instance to serialize.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L96_C2", "label": "data =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "vector": [14, 1, 0.6038, 0.0063, 1, 0.94, 0.3333, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "label": "for attr_name", "type": "for", "loc": [97, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "vector": [6, 1, 0.6321, 0.0503, 1, 0.94, 0.6667, 722, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "attr_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for attr_name in dir(obj):\n if attr_name.startswith('_'):\n continue\n attr = getattr(obj, attr_name)\n if attr is None or callable(attr):\n continue\n # Looks okay, serialize it.\n data[lower_camel_case(attr_name)] = serialize(attr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L98_C4", "label": "if", "type": "if", "loc": [98, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "vector": [4, 2, 0.6195, 0.0126, 2, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attr_name.startswith('_'):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L100_C4", "label": "attr = getattr()", "type": "assigned_variable", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "vector": [14, 2, 0.6289, 0.0063, 2, 0.35, 0.3333, 400, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "attr", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " attr = getattr(obj, attr_name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L101_C4", "label": "if", "type": "if", "loc": [101, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "vector": [4, 2, 0.6384, 0.0126, 2, 0.35, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if attr is None or callable(attr):\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L104_C4", "label": " = serialize()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "vector": [14, 2, 0.6541, 0.0063, 2, 0.35, 1.0, 0, 3, 1, 0, 0, 50, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " data[lower_camel_case(attr_name)] = serialize(attr)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L105_C2", "label": "return", "type": "return", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "vector": [13, 1, 0.6604, 0.0063, 1, 0.94, 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_1143:FunctionDef_L108_C0", "label": "_serialize_dict", "type": "function", "loc": [108, 120], "level": 0, "parent": null, "vector": [2, 0, 0.717, 0.0818, 0, 0.66, 0.8571, 134, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_serialize_dict", "arg_names": ["d"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _serialize_dict(d):\n \"\"\"Invokes serialize on all of its key/value pairs.\n\n Args:\n d: The dict instance to serialize.\n\n Returns:\n The serialized dict."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L109_C2", "label": "expression", "type": "expression", "loc": [109, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "vector": [8, 1, 0.7075, 0.0503, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Invokes serialize on all of its key/value pairs.\n\n Args:\n d: The dict instance to serialize.\n\n Returns:\n The serialized dict.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L117_C2", "label": "data =", "type": "assigned_variable", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "vector": [14, 1, 0.7358, 0.0063, 1, 0.98, 0.3333, 929, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L118_C2", "label": "for k, v", "type": "for", "loc": [118, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "vector": [6, 1, 0.7453, 0.0126, 1, 0.98, 0.6667, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in d.items():\n data[lower_camel_case(k)] = serialize(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L119_C4", "label": " = serialize()", "type": "assigned_variable", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L118_C2", "vector": [14, 2, 0.7484, 0.0063, 2, 0.38, 0.0, 0, 3, 1, 0, 0, 50, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " data[lower_camel_case(k)] = serialize(v)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L120_C2", "label": "return", "type": "return", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "vector": [13, 1, 0.7547, 0.0063, 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 data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "label": "serialize", "type": "function", "loc": [123, 147], "level": 0, "parent": null, "vector": [2, 0, 0.8491, 0.1572, 0, 0.66, 0.9286, 50, 0, 1, 1, 0, 0, 0, 10], "semantic": {"name": "serialize", "arg_names": ["obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def serialize(obj):\n \"\"\"Serializes any instance.\n\n If this is a user-defined instance\n type, it will first check for a custom Serialize() function and use that\n if it exists. Otherwise, it will invoke serialize all of its public\n attributes. Lists and dicts are serialized trivially.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L124_C2", "label": "expression", "type": "expression", "loc": [124, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "vector": [8, 1, 0.8176, 0.0818, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serializes any instance.\n\n If this is a user-defined instance\n type, it will first check for a custom Serialize() function and use that\n if it exists. Otherwise, it will invoke serialize all of its public\n attributes. Lists and dicts are serialized trivially.\n\n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "label": "if", "type": "if", "loc": [137, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "vector": [4, 1, 0.8899, 0.0629, 1, 0.3, 0.5, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if is_user_defined_new_style_class(obj):\n if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):\n method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)\n if callable(method):\n return method()\n return _serialize_attributes(obj)\n elif is_dict(obj):\n return _serialize_dict(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4", "label": "if", "type": "if", "loc": [138, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "vector": [4, 2, 0.8774, 0.0252, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj and hasattr(obj, CUSTOM_SERIALIZE_METHOD_NAME):\n method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)\n if callable(method):\n return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L139_C6", "label": "method = getattr()", "type": "assigned_variable", "loc": [139, 139], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4", "vector": [14, 3, 0.8742, 0.0063, 3, 0.21, 0.0, 445, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "method", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " method = getattr(obj, CUSTOM_SERIALIZE_METHOD_NAME)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L140_C6", "label": "if", "type": "if", "loc": [140, 141], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4", "vector": [4, 3, 0.8836, 0.0126, 3, 0.21, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callable(method):\n return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L141_C8", "label": "return", "type": "return", "loc": [141, 141], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L140_C6", "vector": [13, 4, 0.8868, 0.0063, 4, 0.94, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return method()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L142_C4", "label": "return", "type": "return", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "vector": [13, 2, 0.8931, 0.0063, 2, 0.26, 0.5, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _serialize_attributes(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2", "label": "if", "type": "if", "loc": [143, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "vector": [4, 2, 0.9088, 0.0252, 2, 0.26, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif is_dict(obj):\n return _serialize_dict(obj)\n elif is_iterable(obj):\n return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L144_C4", "label": "return", "type": "return", "loc": [144, 144], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2", "vector": [13, 3, 0.9057, 0.0063, 3, 0.4, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _serialize_dict(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L145_C2", "label": "if", "type": "if", "loc": [145, 146], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2", "vector": [4, 3, 0.9151, 0.0126, 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 is_iterable(obj):\n return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L146_C4", "label": "return", "type": "return", "loc": [146, 146], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L145_C2", "vector": [13, 4, 0.9182, 0.0063, 4, 0.07, 0.0, 0, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [serialize(v) for v in obj]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L147_C2", "label": "return", "type": "return", "loc": [147, 147], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "vector": [13, 1, 0.9245, 0.0063, 1, 0.3, 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_1143:ClassDef_L150_C0", "label": "StringEnum", "type": "class", "loc": [150, 159], "level": 0, "parent": null, "vector": [3, 0, 0.9717, 0.0629, 0, 0.66, 1.0, 716, 0, 1, 0, 0, 186, 0, 1], "semantic": {"name": "StringEnum", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StringEnum(object):\n \"\"\"Enum like class that is configured with a list of values.\n\n This class effectively implements an enum for Elements, except for that\n the actual values of the enums will be the string values.\n \"\"\"\n\n def __init__(self, *values):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L151_C2", "label": "expression", "type": "expression", "loc": [151, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:ClassDef_L150_C0", "vector": [8, 1, 0.9623, 0.0314, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Enum like class that is configured with a list of values.\n\n This class effectively implements an enum for Elements, except for that\n the actual values of the enums will be the string values.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L157_C2", "label": "__init__", "type": "function", "loc": [157, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:ClassDef_L150_C0", "vector": [2, 1, 0.9937, 0.0189, 1, 0.94, 1.0, 555, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "values"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *values):\n for name in values:\n setattr(self, name, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L158_C4", "label": "for name", "type": "for", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L157_C2", "vector": [6, 2, 0.9969, 0.0126, 2, 0.32, 0.0, 57, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for name in values:\n setattr(self, name, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L159_C6", "label": "setattr()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L158_C4", "vector": [8, 3, 1.0, 0.0063, 3, 0.33, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(self, name, name)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L29_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L63_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L117_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L118_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L119_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L108_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Assign_L139_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L138_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L140_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L140_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L137_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L145_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:If_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L123_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Return_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:ClassDef_L150_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L157_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:FunctionDef_L157_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1143:For_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1143:Expr_L159_C6"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Module defines the ModuleTestRunnerClass."""
import unittest
class ModuleTestRunner(object):
"""Responsible for executing all test cases in a list of modules."""
def __init__(self, module_list=None, module_test_settings=None):
self.modules = module_list or []
self.settings = module_test_settings or {}
def RunAllTests(self):
"""Executes all tests present in the list of modules."""
runner = unittest.TextTestRunner()
for module in self.modules:
for setting, value in self.settings.iteritems():
try:
setattr(module, setting, value)
except AttributeError:
print '\nError running ' + str(setting)
print '\nRunning all tests in module', module.__name__
runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))
| ajibawa-2023/Python-Code-Large/train/row_1144 | 17 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.425, 0.025, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Module defines the ModuleTestRunnerClass.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.025, 0, 0.66, 0.5, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "label": "ModuleTestRunner", "type": "class", "loc": [23, 40], "level": 0, "parent": null, "vector": [3, 0, 0.7875, 0.45, 0, 0.66, 1.0, 109, 0, 2, 0, 0, 186, 0, 8], "semantic": {"name": "ModuleTestRunner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ModuleTestRunner(object):\n \"\"\"Responsible for executing all test cases in a list of modules.\"\"\"\n\n def __init__(self, module_list=None, module_test_settings=None):\n self.modules = module_list or []\n self.settings = module_test_settings or {}\n\n def RunAllTests(self):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L24_C2", "label": "expression", "type": "expression", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "vector": [8, 1, 0.6, 0.025, 1, 0.58, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Responsible for executing all test cases in a list of modules.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2", "label": "__init__", "type": "function", "loc": [26, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "vector": [2, 1, 0.675, 0.075, 1, 0.58, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "module_list", "module_test_settings"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, module_list=None, module_test_settings=None):\n self.modules = module_list or []\n self.settings = module_test_settings or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L27_C4", "label": "self.modules =", "type": "assigned_variable", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2", "vector": [14, 2, 0.675, 0.025, 2, 0.65, 0.0, 847, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.modules", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.modules = module_list or []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L28_C4", "label": "self.settings =", "type": "assigned_variable", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2", "vector": [14, 2, 0.7, 0.025, 2, 0.65, 1.0, 673, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.settings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.settings = module_test_settings or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "label": "RunAllTests", "type": "function", "loc": [30, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "vector": [2, 1, 0.875, 0.275, 1, 0.58, 1.0, 52, 0, 1, 0, 0, 0, 0, 8], "semantic": {"name": "RunAllTests", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def RunAllTests(self):\n \"\"\"Executes all tests present in the list of modules.\"\"\"\n runner = unittest.TextTestRunner()\n for module in self.modules:\n for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L31_C4", "label": "expression", "type": "expression", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "vector": [8, 2, 0.775, 0.025, 2, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Executes all tests present in the list of modules.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L32_C4", "label": "runner = TextTestRunner()", "type": "assigned_variable", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "vector": [14, 2, 0.8, 0.025, 2, 0.25, 0.5, 180, 3, 0, 0, 0, 130, 10, 1], "semantic": {"name": "runner", "arg_names": [], "import_names": [], "rhs_call_name": "TextTestRunner", "annotation": ""}, "snippet": " runner = unittest.TextTestRunner()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "label": "for module", "type": "for", "loc": [33, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "vector": [6, 2, 0.9125, 0.2, 2, 0.25, 1.0, 98, 7, 0, 0, 0, 0, 0, 7], "semantic": {"name": "module", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for module in self.modules:\n for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))\n print('\\nRunning all tests in module', module.__name__)\n runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L34_C6", "label": "for setting, value", "type": "for", "loc": [34, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "vector": [6, 3, 0.9, 0.125, 3, 0.83, 0.0, 571, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "setting, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for setting, value in self.settings.iteritems():\n try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8", "label": "try", "type": "try", "loc": [35, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L34_C6", "vector": [7, 4, 0.9125, 0.1, 4, 0.68, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n setattr(module, setting, value)\n except AttributeError:\n print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L36_C10", "label": "setattr()", "type": "expression", "loc": [36, 36], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8", "vector": [8, 5, 0.9, 0.025, 5, 0.47, 0.0, 501, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "setattr", "arg_names": [], "import_names": [], "rhs_call_name": "setattr", "annotation": ""}, "snippet": " setattr(module, setting, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L38_C10", "label": "print()", "type": "expression", "loc": [38, 38], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8", "vector": [8, 5, 0.95, 0.025, 5, 0.47, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nError running ' + str(setting))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L39_C6", "label": "print()", "type": "expression", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "vector": [8, 3, 0.975, 0.025, 3, 0.83, 0.5, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nRunning all tests in module', module.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L40_C6", "label": "run()", "type": "expression", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "vector": [8, 3, 1.0, 0.025, 3, 0.83, 1.0, 679, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "run", "annotation": ""}, "snippet": " runner.run(unittest.defaultTestLoader.loadTestsFromModule(module))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L24_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L27_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L26_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Assign_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:FunctionDef_L30_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L34_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L34_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L36_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:Try_L35_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L38_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L39_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1144:For_L33_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1144:Expr_L40_C6"}] |
import simplejson
import cgi
class JSONFilter(object):
def __init__(self, app, mime_type='text/x-json'):
self.app = app
self.mime_type = mime_type
def __call__(self, environ, start_response):
# Read JSON POST input to jsonfilter.json if matching mime type
response = {'status': '200 OK', 'headers': []}
def json_start_response(status, headers):
response['status'] = status
response['headers'].extend(headers)
environ['jsonfilter.mime_type'] = self.mime_type
if environ.get('REQUEST_METHOD', '') == 'POST':
if environ.get('CONTENT_TYPE', '') == self.mime_type:
args = [_ for _ in [environ.get('CONTENT_LENGTH')] if _]
data = environ['wsgi.input'].read(*map(int, args))
environ['jsonfilter.json'] = simplejson.loads(data)
res = simplejson.dumps(self.app(environ, json_start_response))
jsonp = cgi.parse_qs(environ.get('QUERY_STRING', '')).get('jsonp')
if jsonp:
content_type = 'text/javascript'
res = ''.join(jsonp + ['(', res, ')'])
elif 'Opera' in environ.get('HTTP_USER_AGENT', ''):
# Opera has bunk XMLHttpRequest support for most mime types
content_type = 'text/plain'
else:
content_type = self.mime_type
headers = [
('Content-type', content_type),
('Content-length', len(res)),
]
headers.extend(response['headers'])
start_response(response['status'], headers)
return [res]
def factory(app, global_conf, **kw):
return JSONFilter(app, **kw)
| ajibawa-2023/Python-Code-Large/train/row_1145 | 31 | 40 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Import_L1_C0", "label": "simplejson import simplejson", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.025, 0.025, 0, 0.66, 0.0, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Import_L2_C0", "label": "cgi import cgi", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.05, 0.025, 0, 0.66, 0.3333, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:ClassDef_L4_C0", "label": "JSONFilter", "type": "class", "loc": [4, 37], "level": 0, "parent": null, "vector": [3, 0, 0.5125, 0.85, 0, 0.66, 0.6667, 959, 0, 3, 0, 0, 186, 0, 17], "semantic": {"name": "JSONFilter", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONFilter(object):\n def __init__(self, app, mime_type='text/x-json'):\n self.app = app\n self.mime_type = mime_type\n\n def __call__(self, environ, start_response):\n # Read JSON POST input to jsonfilter.json if matching mime type\n response = {'status': '200 OK', 'headers': []}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4", "label": "__init__", "type": "function", "loc": [5, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:ClassDef_L4_C0", "vector": [2, 1, 0.15, 0.075, 1, 0.87, 0.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "app", "mime_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, app, mime_type='text/x-json'):\n self.app = app\n self.mime_type = mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L6_C8", "label": "self.app =", "type": "assigned_variable", "loc": [6, 6], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4", "vector": [14, 2, 0.15, 0.025, 2, 0.14, 0.0, 809, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.app", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.app = app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L7_C8", "label": "self.mime_type =", "type": "assigned_variable", "loc": [7, 7], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4", "vector": [14, 2, 0.175, 0.025, 2, 0.14, 1.0, 84, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.mime_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.mime_type = mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "label": "__call__", "type": "function", "loc": [9, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:ClassDef_L4_C0", "vector": [2, 1, 0.575, 0.725, 1, 0.87, 1.0, 319, 0, 3, 1, 0, 0, 0, 17], "semantic": {"name": "__call__", "arg_names": ["self", "environ", "start_response"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __call__(self, environ, start_response):\n # Read JSON POST input to jsonfilter.json if matching mime type\n response = {'status': '200 OK', 'headers': []}\n def json_start_response(status, headers):\n response['status'] = status\n response['headers'].extend(headers)\n environ['jsonfilter.mime_type'] = self.mime_type\n if environ.get('REQUEST_METHOD', '') == 'POST':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L11_C8", "label": "response =", "type": "assigned_variable", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [14, 2, 0.275, 0.025, 2, 0.37, 0.0, 511, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "response", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response = {'status': '200 OK', 'headers': []}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8", "label": "json_start_response", "type": "function", "loc": [12, 14], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [2, 2, 0.325, 0.075, 2, 0.37, 0.1, 167, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "json_start_response", "arg_names": ["status", "headers"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def json_start_response(status, headers):\n response['status'] = status\n response['headers'].extend(headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L13_C12", "label": "assign", "type": "assigned_variable", "loc": [13, 13], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8", "vector": [14, 3, 0.325, 0.025, 3, 0.99, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " response['status'] = status"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L14_C12", "label": "extend()", "type": "expression", "loc": [14, 14], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8", "vector": [8, 3, 0.35, 0.025, 3, 0.99, 1.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " response['headers'].extend(headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L15_C8", "label": "assign", "type": "assigned_variable", "loc": [15, 15], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [14, 2, 0.375, 0.025, 2, 0.37, 0.2, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " environ['jsonfilter.mime_type'] = self.mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L16_C8", "label": "if", "type": "if", "loc": [16, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [4, 2, 0.45, 0.125, 2, 0.37, 0.3, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if environ.get('REQUEST_METHOD', '') == 'POST':\n if environ.get('CONTENT_TYPE', '') == self.mime_type:\n args = [_ for _ in [environ.get('CONTENT_LENGTH')] if _]\n data = environ['wsgi.input'].read(*map(int, args))\n environ['jsonfilter.json'] = simplejson.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "label": "if", "type": "if", "loc": [17, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L16_C8", "vector": [4, 3, 0.4625, 0.1, 3, 0.57, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if environ.get('CONTENT_TYPE', '') == self.mime_type:\n args = [_ for _ in [environ.get('CONTENT_LENGTH')] if _]\n data = environ['wsgi.input'].read(*map(int, args))\n environ['jsonfilter.json'] = simplejson.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L18_C16", "label": "args =", "type": "assigned_variable", "loc": [18, 18], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "vector": [14, 4, 0.45, 0.025, 4, 0.29, 0.0, 805, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = [_ for _ in [environ.get('CONTENT_LENGTH')] if _]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L19_C16", "label": "data = read()", "type": "assigned_variable", "loc": [19, 19], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "vector": [14, 4, 0.475, 0.025, 4, 0.29, 0.5, 929, 3, 1, 0, 0, 453, 10, 2], "semantic": {"name": "data", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " data = environ['wsgi.input'].read(*map(int, args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L20_C16", "label": " = loads()", "type": "assigned_variable", "loc": [20, 20], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "vector": [14, 4, 0.5, 0.025, 4, 0.29, 1.0, 0, 3, 1, 0, 0, 88, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "loads", "annotation": ""}, "snippet": " environ['jsonfilter.json'] = simplejson.loads(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L21_C8", "label": "res = dumps()", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [14, 2, 0.525, 0.025, 2, 0.37, 0.4, 413, 3, 1, 0, 0, 160, 10, 2], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " res = simplejson.dumps(self.app(environ, json_start_response))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L22_C8", "label": "jsonp = get()", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [14, 2, 0.55, 0.025, 2, 0.37, 0.5, 265, 3, 1, 0, 0, 607, 10, 3], "semantic": {"name": "jsonp", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " jsonp = cgi.parse_qs(environ.get('QUERY_STRING', '')).get('jsonp')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "label": "if", "type": "if", "loc": [23, 30], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [4, 2, 0.6625, 0.2, 2, 0.37, 0.6, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if jsonp:\n content_type = 'text/javascript'\n res = ''.join(jsonp + ['(', res, ')'])\n elif 'Opera' in environ.get('HTTP_USER_AGENT', ''):\n # Opera has bunk XMLHttpRequest support for most mime types\n content_type = 'text/plain'\n else:\n content_type = self.mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L24_C12", "label": "content_type =", "type": "assigned_variable", "loc": [24, 24], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "vector": [14, 3, 0.6, 0.025, 3, 0.91, 0.0, 610, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_type = 'text/javascript'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L25_C12", "label": "res = join()", "type": "assigned_variable", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "vector": [14, 3, 0.625, 0.025, 3, 0.91, 0.5, 413, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " res = ''.join(jsonp + ['(', res, ')'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8", "label": "if", "type": "if", "loc": [26, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "vector": [4, 3, 0.7, 0.125, 3, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif 'Opera' in environ.get('HTTP_USER_AGENT', ''):\n # Opera has bunk XMLHttpRequest support for most mime types\n content_type = 'text/plain'\n else:\n content_type = self.mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L28_C12", "label": "content_type =", "type": "assigned_variable", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8", "vector": [14, 4, 0.7, 0.025, 4, 0.7, 0.0, 610, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_type = 'text/plain'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L30_C12", "label": "content_type =", "type": "assigned_variable", "loc": [30, 30], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8", "vector": [14, 4, 0.75, 0.025, 4, 0.7, 1.0, 610, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_type = self.mime_type"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L31_C8", "label": "headers =", "type": "assigned_variable", "loc": [31, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [14, 2, 0.8125, 0.1, 2, 0.37, 0.7, 950, 0, 0, 0, 0, 0, 5, 1], "semantic": {"name": "headers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " headers = [\n ('Content-type', content_type),\n ('Content-length', len(res)),\n ]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L35_C8", "label": "extend()", "type": "expression", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [8, 2, 0.875, 0.025, 2, 0.37, 0.8, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " headers.extend(response['headers'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L36_C8", "label": "start_response()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [8, 2, 0.9, 0.025, 2, 0.37, 0.9, 638, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "start_response", "arg_names": [], "import_names": [], "rhs_call_name": "start_response", "annotation": ""}, "snippet": " start_response(response['status'], headers)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Return_L37_C8", "label": "return", "type": "return", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "vector": [13, 2, 0.925, 0.025, 2, 0.37, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return [res]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L39_C0", "label": "factory", "type": "function", "loc": [39, 40], "level": 0, "parent": null, "vector": [2, 0, 0.9875, 0.05, 0, 0.66, 1.0, 235, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "factory", "arg_names": ["app", "global_conf", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def factory(app, global_conf, **kw):\n return JSONFilter(app, **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1145:Return_L40_C4", "label": "return", "type": "return", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L39_C0", "vector": [13, 1, 1.0, 0.025, 1, 0.88, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return JSONFilter(app, **kw)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1145:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L13_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L12_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L14_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L15_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L16_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L18_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L19_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L17_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L20_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L24_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L23_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L28_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:If_L26_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L35_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Return_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1145:FunctionDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1145:Return_L40_C4"}] |
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger
http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
try:
all
except NameError:
def all(seq):
for elem in seq:
if not elem:
return False
return True
class OrderedDict(dict, DictMixin):
def __init__(self, *args, **kwds):
if len(args) > 1:
raise TypeError('expected at most 1 arguments, got %d' % len(args))
try:
self.__end
except AttributeError:
self.clear()
self.update(*args, **kwds)
def clear(self):
self.__end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)
def __setitem__(self, key, value):
if key not in self:
end = self.__end
curr = end[1]
curr[2] = end[1] = self.__map[key] = [key, curr, end]
dict.__setitem__(self, key, value)
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev
def __iter__(self):
end = self.__end
curr = end[2]
while curr is not end:
yield curr[0]
curr = curr[2]
def __reversed__(self):
end = self.__end
curr = end[1]
while curr is not end:
yield curr[0]
curr = curr[1]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value
def __reduce__(self):
items = [[k, self[k]] for k in self]
tmp = self.__map, self.__end
del self.__map, self.__end
inst_dict = vars(self).copy()
self.__map, self.__end = tmp
if inst_dict:
return (self.__class__, (items,), inst_dict)
return self.__class__, (items,)
def keys(self):
return list(self)
setdefault = DictMixin.setdefault
update = DictMixin.update
pop = DictMixin.pop
values = DictMixin.values
items = DictMixin.items
iterkeys = DictMixin.iterkeys
itervalues = DictMixin.itervalues
iteritems = DictMixin.iteritems
def __repr__(self):
if not self:
return '%s()' % (self.__class__.__name__,)
return '%s(%r)' % (self.__class__.__name__, self.items())
def copy(self):
return self.__class__(self)
@classmethod
def fromkeys(cls, iterable, value=None):
d = cls()
for key in iterable:
d[key] = value
return d
def __eq__(self, other):
if isinstance(other, OrderedDict):
return len(self)==len(other) and \
all(p==q for p, q in zip(self.items(), other.items()))
return dict.__eq__(self, other)
def __ne__(self, other):
return not self == other
| ajibawa-2023/Python-Code-Large/train/row_1147 | 85 | 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_1147:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0252, 0.042, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Drop-in replacement for collections.OrderedDict by Raymond Hettinger\n\nhttp://code.activestate.com/recipes/576693/\n\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:ImportFrom_L6_C0", "label": "from UserDict import DictMixin", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0504, 0.0084, 0, 0.66, 0.3333, 351, 0, 1, 0, 0, 351, 0, 0], "semantic": {"name": "UserDict", "arg_names": [], "import_names": ["DictMixin"], "rhs_call_name": "", "annotation": ""}, "snippet": "from UserDict import DictMixin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L10_C0", "label": "try", "type": "try", "loc": [10, 17], "level": 0, "parent": null, "vector": [7, 0, 0.1134, 0.0672, 0, 0.66, 0.6667, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n all\nexcept NameError:\n def all(seq):\n for elem in seq:\n if not elem:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L11_C4", "label": "expression", "type": "expression", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L10_C0", "vector": [8, 1, 0.0924, 0.0084, 1, 0.74, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4", "label": "all", "type": "function", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L10_C0", "vector": [2, 1, 0.1261, 0.042, 1, 0.74, 0.0, 895, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "all", "arg_names": ["seq"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def all(seq):\n for elem in seq:\n if not elem:\n return False\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L14_C8", "label": "for elem", "type": "for", "loc": [14, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4", "vector": [6, 2, 0.1261, 0.0252, 2, 0.66, 0.0, 63, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "elem", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for elem in seq:\n if not elem:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L15_C12", "label": "if", "type": "if", "loc": [15, 16], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L14_C8", "vector": [4, 3, 0.1303, 0.0168, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not elem:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L16_C16", "label": "return", "type": "return", "loc": [16, 16], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L15_C12", "vector": [13, 4, 0.1345, 0.0084, 4, 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_1147:Return_L17_C8", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4", "vector": [13, 2, 0.1429, 0.0084, 2, 0.66, 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_1147:ClassDef_L19_C0", "label": "OrderedDict", "type": "class", "loc": [19, 119], "level": 0, "parent": null, "vector": [3, 0, 0.5798, 0.8487, 0, 0.66, 1.0, 92, 0, 14, 0, 0, 827, 0, 29], "semantic": {"name": "OrderedDict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OrderedDict(dict, DictMixin):\n\n def __init__(self, *args, **kwds):\n if len(args) > 1:\n raise TypeError('expected at most 1 arguments, got %d' % len(args))\n try:\n self.__end\n except AttributeError:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "label": "__init__", "type": "function", "loc": [21, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.2059, 0.0672, 1, 0.02, 0.0, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "args", "kwds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, *args, **kwds):\n if len(args) > 1:\n raise TypeError('expected at most 1 arguments, got %d' % len(args))\n try:\n self.__end\n except AttributeError:\n self.clear()\n self.update(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L22_C8", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "vector": [4, 2, 0.1891, 0.0168, 2, 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(args) > 1:\n raise TypeError('expected at most 1 arguments, got %d' % len(args))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8", "label": "try", "type": "try", "loc": [24, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "vector": [7, 2, 0.2143, 0.0336, 2, 0.2, 0.5, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n self.__end\n except AttributeError:\n self.clear()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L25_C12", "label": "expression", "type": "expression", "loc": [25, 25], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8", "vector": [8, 3, 0.2101, 0.0084, 3, 0.26, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L27_C12", "label": "clear()", "type": "expression", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8", "vector": [8, 3, 0.2269, 0.0084, 3, 0.26, 0.0, 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_1147:Expr_L28_C8", "label": "update()", "type": "expression", "loc": [28, 28], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "vector": [8, 2, 0.2353, 0.0084, 2, 0.2, 1.0, 637, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " self.update(*args, **kwds)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "label": "clear", "type": "function", "loc": [30, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.2689, 0.042, 1, 0.02, 0.0476, 712, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def clear(self):\n self.__end = end = []\n end += [None, end, end] # sentinel node for doubly linked list\n self.__map = {} # key --> [key, prev, next]\n dict.clear(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L31_C8", "label": "self.__end =", "type": "assigned_variable", "loc": [31, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "vector": [14, 2, 0.2605, 0.0084, 2, 0.86, 0.0, 444, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "self.__end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__end = end = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L33_C8", "label": "self.__map =", "type": "assigned_variable", "loc": [33, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "vector": [14, 2, 0.2773, 0.0084, 2, 0.86, 0.5, 537, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.__map", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__map = {} # key --> [key, prev, next]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L34_C8", "label": "clear()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "vector": [8, 2, 0.2857, 0.0084, 2, 0.86, 1.0, 712, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "clear", "arg_names": [], "import_names": [], "rhs_call_name": "clear", "annotation": ""}, "snippet": " dict.clear(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4", "label": "__setitem__", "type": "function", "loc": [36, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.3235, 0.0504, 1, 0.02, 0.0952, 343, 0, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": ["self", "key", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __setitem__(self, key, value):\n if key not in self:\n end = self.__end\n curr = end[1]\n curr[2] = end[1] = self.__map[key] = [key, curr, end]\n dict.__setitem__(self, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "label": "if", "type": "if", "loc": [37, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4", "vector": [4, 2, 0.3235, 0.0336, 2, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if key not in self:\n end = self.__end\n curr = end[1]\n curr[2] = end[1] = self.__map[key] = [key, curr, end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L38_C12", "label": "end =", "type": "assigned_variable", "loc": [38, 38], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "vector": [14, 3, 0.3193, 0.0084, 3, 0.11, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = self.__end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L39_C12", "label": "curr =", "type": "assigned_variable", "loc": [39, 39], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "vector": [14, 3, 0.3277, 0.0084, 3, 0.11, 0.5, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr = end[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L40_C12", "label": "assign", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "vector": [14, 3, 0.3361, 0.0084, 3, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr[2] = end[1] = self.__map[key] = [key, curr, end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L41_C8", "label": "__setitem__()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4", "vector": [8, 2, 0.3445, 0.0084, 2, 0.18, 1.0, 343, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "__setitem__", "arg_names": [], "import_names": [], "rhs_call_name": "__setitem__", "annotation": ""}, "snippet": " dict.__setitem__(self, key, value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "label": "__delitem__", "type": "function", "loc": [43, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.3782, 0.042, 1, 0.02, 0.1429, 66, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__delitem__", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __delitem__(self, key):\n dict.__delitem__(self, key)\n key, prev, next = self.__map.pop(key)\n prev[2] = next\n next[1] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L44_C8", "label": "__delitem__()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "vector": [8, 2, 0.3697, 0.0084, 2, 0.37, 0.0, 66, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "__delitem__", "arg_names": [], "import_names": [], "rhs_call_name": "__delitem__", "annotation": ""}, "snippet": " dict.__delitem__(self, key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L45_C8", "label": "key, prev, next = pop()", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "vector": [14, 2, 0.3782, 0.0084, 2, 0.37, 0.3333, 295, 3, 1, 0, 0, 969, 10, 1], "semantic": {"name": "key, prev, next", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " key, prev, next = self.__map.pop(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L46_C8", "label": "assign", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "vector": [14, 2, 0.3866, 0.0084, 2, 0.37, 0.6667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev[2] = next"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L47_C8", "label": "assign", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "vector": [14, 2, 0.395, 0.0084, 2, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " next[1] = prev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "label": "__iter__", "type": "function", "loc": [49, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.4328, 0.0504, 1, 0.02, 0.1905, 891, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__iter__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __iter__(self):\n end = self.__end\n curr = end[2]\n while curr is not end:\n yield curr[0]\n curr = curr[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L50_C8", "label": "end =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "vector": [14, 2, 0.4202, 0.0084, 2, 0.95, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = self.__end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L51_C8", "label": "curr =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "vector": [14, 2, 0.4286, 0.0084, 2, 0.95, 0.5, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr = end[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8", "label": "while", "type": "while", "loc": [52, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "vector": [5, 2, 0.4454, 0.0252, 2, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while curr is not end:\n yield curr[0]\n curr = curr[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L53_C12", "label": "expression", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8", "vector": [8, 3, 0.4454, 0.0084, 3, 0.48, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield curr[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L54_C12", "label": "curr =", "type": "assigned_variable", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8", "vector": [14, 3, 0.4538, 0.0084, 3, 0.48, 1.0, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr = curr[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "label": "__reversed__", "type": "function", "loc": [56, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.4916, 0.0504, 1, 0.02, 0.2381, 62, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "__reversed__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __reversed__(self):\n end = self.__end\n curr = end[1]\n while curr is not end:\n yield curr[0]\n curr = curr[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L57_C8", "label": "end =", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "vector": [14, 2, 0.479, 0.0084, 2, 0.29, 0.0, 128, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end = self.__end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L58_C8", "label": "curr =", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "vector": [14, 2, 0.4874, 0.0084, 2, 0.29, 0.5, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr = end[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8", "label": "while", "type": "while", "loc": [59, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "vector": [5, 2, 0.5042, 0.0252, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while curr is not end:\n yield curr[0]\n curr = curr[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L60_C12", "label": "expression", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8", "vector": [8, 3, 0.5042, 0.0084, 3, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield curr[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L61_C12", "label": "curr =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8", "vector": [14, 3, 0.5126, 0.0084, 3, 0.86, 1.0, 503, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr = curr[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "label": "popitem", "type": "function", "loc": [63, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.5714, 0.0924, 1, 0.02, 0.2857, 553, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "popitem", "arg_names": ["self", "last"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def popitem(self, last=True):\n if not self:\n raise KeyError('dictionary is empty')\n # Modified from original to support Python 2.4, see\n # http://code.google.com/p/simplejson/issues/detail?id=53\n if last:\n key = reversed(self).next()\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "vector": [4, 2, 0.542, 0.0168, 2, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self:\n raise KeyError('dictionary is empty')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8", "label": "if", "type": "if", "loc": [68, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "vector": [4, 2, 0.584, 0.0336, 2, 0.22, 0.3333, 0, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if last:\n key = reversed(self).next()\n else:\n key = iter(self).next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L69_C12", "label": "key = next()", "type": "assigned_variable", "loc": [69, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8", "vector": [14, 3, 0.5798, 0.0084, 3, 0.13, 0.0, 230, 3, 0, 0, 0, 11, 10, 2], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " key = reversed(self).next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L71_C12", "label": "key = next()", "type": "assigned_variable", "loc": [71, 71], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8", "vector": [14, 3, 0.5966, 0.0084, 3, 0.13, 1.0, 230, 3, 0, 0, 0, 11, 10, 2], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "next", "annotation": ""}, "snippet": " key = iter(self).next()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L72_C8", "label": "value = pop()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "vector": [14, 2, 0.605, 0.0084, 2, 0.22, 0.6667, 441, 3, 1, 0, 0, 969, 10, 1], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "pop", "annotation": ""}, "snippet": " value = self.pop(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L73_C8", "label": "return", "type": "return", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "vector": [13, 2, 0.6134, 0.0084, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key, value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "label": "__reduce__", "type": "function", "loc": [75, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.6639, 0.0756, 1, 0.02, 0.3333, 591, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "__reduce__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __reduce__(self):\n items = [[k, self[k]] for k in self]\n tmp = self.__map, self.__end\n del self.__map, self.__end\n inst_dict = vars(self).copy()\n self.__map, self.__end = tmp\n if inst_dict:\n return (self.__class__, (items,), inst_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L76_C8", "label": "items =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [14, 2, 0.6387, 0.0084, 2, 0.39, 0.0, 339, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = [[k, self[k]] for k in self]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L77_C8", "label": "tmp =", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [14, 2, 0.6471, 0.0084, 2, 0.39, 0.2, 517, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "tmp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tmp = self.__map, self.__end"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L79_C8", "label": "inst_dict = copy()", "type": "assigned_variable", "loc": [79, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [14, 2, 0.6639, 0.0084, 2, 0.39, 0.4, 752, 3, 0, 0, 0, 739, 10, 2], "semantic": {"name": "inst_dict", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " inst_dict = vars(self).copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L80_C8", "label": "assign", "type": "assigned_variable", "loc": [80, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [14, 2, 0.6723, 0.0084, 2, 0.39, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.__map, self.__end = tmp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L81_C8", "label": "if", "type": "if", "loc": [81, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [4, 2, 0.6849, 0.0168, 2, 0.39, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if inst_dict:\n return (self.__class__, (items,), inst_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L82_C12", "label": "return", "type": "return", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L81_C8", "vector": [13, 3, 0.6891, 0.0084, 3, 0.27, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (self.__class__, (items,), inst_dict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L83_C8", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "vector": [13, 2, 0.6975, 0.0084, 2, 0.39, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__class__, (items,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L85_C4", "label": "keys", "type": "function", "loc": [85, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.7185, 0.0168, 1, 0.02, 0.381, 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 list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L86_C8", "label": "return", "type": "return", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L85_C4", "vector": [13, 2, 0.7227, 0.0084, 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 list(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L88_C4", "label": "setdefault =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7395, 0.0084, 1, 0.02, 0.4286, 262, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " setdefault = DictMixin.setdefault"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L89_C4", "label": "update =", "type": "assigned_variable", "loc": [89, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7479, 0.0084, 1, 0.02, 0.4762, 637, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " update = DictMixin.update"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L90_C4", "label": "pop =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7563, 0.0084, 1, 0.02, 0.5238, 969, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pop", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pop = DictMixin.pop"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L91_C4", "label": "values =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7647, 0.0084, 1, 0.02, 0.5714, 721, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "values", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " values = DictMixin.values"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L92_C4", "label": "items =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7731, 0.0084, 1, 0.02, 0.619, 339, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " items = DictMixin.items"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L93_C4", "label": "iterkeys =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7815, 0.0084, 1, 0.02, 0.6667, 232, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "iterkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iterkeys = DictMixin.iterkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L94_C4", "label": "itervalues =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7899, 0.0084, 1, 0.02, 0.7143, 288, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "itervalues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " itervalues = DictMixin.itervalues"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L95_C4", "label": "iteritems =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [14, 1, 0.7983, 0.0084, 1, 0.02, 0.7619, 252, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "iteritems", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " iteritems = DictMixin.iteritems"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4", "label": "__repr__", "type": "function", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.8277, 0.0336, 1, 0.02, 0.8095, 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 if not self:\n return '%s()' % (self.__class__.__name__,)\n return '%s(%r)' % (self.__class__.__name__, self.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L98_C8", "label": "if", "type": "if", "loc": [98, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4", "vector": [4, 2, 0.8277, 0.0168, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self:\n return '%s()' % (self.__class__.__name__,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L99_C12", "label": "return", "type": "return", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L98_C8", "vector": [13, 3, 0.8319, 0.0084, 3, 0.94, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s()' % (self.__class__.__name__,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L100_C8", "label": "return", "type": "return", "loc": [100, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4", "vector": [13, 2, 0.8403, 0.0084, 2, 0.63, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s(%r)' % (self.__class__.__name__, self.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L102_C4", "label": "copy", "type": "function", "loc": [102, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.8613, 0.0168, 1, 0.02, 0.8571, 739, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "copy", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def copy(self):\n return self.__class__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L103_C8", "label": "return", "type": "return", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L102_C4", "vector": [13, 2, 0.8655, 0.0084, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.__class__(self)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "label": "fromkeys", "type": "function", "loc": [106, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.9076, 0.042, 1, 0.02, 0.9048, 631, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "fromkeys", "arg_names": ["cls", "iterable", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fromkeys(cls, iterable, value=None):\n d = cls()\n for key in iterable:\n d[key] = value\n return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L107_C8", "label": "d = cls()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "vector": [14, 2, 0.8992, 0.0084, 2, 0.13, 0.0, 355, 3, 0, 0, 0, 594, 10, 1], "semantic": {"name": "d", "arg_names": [], "import_names": [], "rhs_call_name": "cls", "annotation": ""}, "snippet": " d = cls()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L108_C8", "label": "for key", "type": "for", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "vector": [6, 2, 0.9118, 0.0168, 2, 0.13, 0.5, 230, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in iterable:\n d[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L109_C12", "label": "assign", "type": "assigned_variable", "loc": [109, 109], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L108_C8", "vector": [14, 3, 0.916, 0.0084, 3, 0.84, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " d[key] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "vector": [13, 2, 0.9244, 0.0084, 2, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return d"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4", "label": "__eq__", "type": "function", "loc": [112, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.958, 0.042, 1, 0.02, 0.9524, 763, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "__eq__", "arg_names": ["self", "other"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __eq__(self, other):\n if isinstance(other, OrderedDict):\n return len(self)==len(other) and \\\n all(p==q for p, q in zip(self.items(), other.items()))\n return dict.__eq__(self, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L113_C8", "label": "if", "type": "if", "loc": [113, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4", "vector": [4, 2, 0.958, 0.0252, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(other, OrderedDict):\n return len(self)==len(other) and \\\n all(p==q for p, q in zip(self.items(), other.items()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L114_C12", "label": "return", "type": "return", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L113_C8", "vector": [13, 3, 0.9622, 0.0168, 3, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(self)==len(other) and \\\n all(p==q for p, q in zip(self.items(), other.items()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L116_C8", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4", "vector": [13, 2, 0.9748, 0.0084, 2, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict.__eq__(self, other)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L118_C4", "label": "__ne__", "type": "function", "loc": [118, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "vector": [2, 1, 0.9958, 0.0168, 1, 0.02, 1.0, 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_1147:Return_L119_C8", "label": "return", "type": "return", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L118_C4", "vector": [13, 2, 1.0, 0.0084, 2, 0.01, 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"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L14_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L15_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L15_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L16_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L17_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L22_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:Try_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L27_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L21_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L28_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L31_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L33_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L30_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L38_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L39_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L37_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L36_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L46_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L49_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L53_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L52_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L54_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L57_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L56_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Expr_L60_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:While_L59_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L69_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L68_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L71_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L73_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L76_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L80_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L81_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L81_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L82_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L83_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L85_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L86_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L98_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L99_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L97_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L100_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L107_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:For_L108_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Assign_L109_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L106_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L113_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:If_L113_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L114_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L116_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:ClassDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1147:FunctionDef_L118_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1147:Return_L119_C8"}] |
"""JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scanner(context):
parse_object = context.parse_object
parse_array = context.parse_array
parse_string = context.parse_string
match_number = NUMBER_RE.match
encoding = context.encoding
strict = context.strict
parse_float = context.parse_float
parse_int = context.parse_int
parse_constant = context.parse_constant
object_hook = context.object_hook
object_pairs_hook = context.object_pairs_hook
def _scan_once(string, idx):
try:
nextchar = string[idx]
except IndexError:
raise StopIteration
if nextchar == '"':
return parse_string(string, idx + 1, encoding, strict)
elif nextchar == '{':
return parse_object((string, idx + 1), encoding, strict,
_scan_once, object_hook, object_pairs_hook)
elif nextchar == '[':
return parse_array((string, idx + 1), _scan_once)
elif nextchar == 'n' and string[idx:idx + 4] == 'null':
return None, idx + 4
elif nextchar == 't' and string[idx:idx + 4] == 'true':
return True, idx + 4
elif nextchar == 'f' and string[idx:idx + 5] == 'false':
return False, idx + 5
m = match_number(string, idx)
if m is not None:
integer, frac, exp = m.groups()
if frac or exp:
res = parse_float(integer + (frac or '') + (exp or ''))
else:
res = parse_int(integer)
return res, m.end()
elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
return parse_constant('NaN'), idx + 3
elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
return parse_constant('Infinity'), idx + 8
elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
return parse_constant('-Infinity'), idx + 9
else:
raise StopIteration
return _scan_once
make_scanner = c_make_scanner or py_make_scanner
| ajibawa-2023/Python-Code-Large/train/row_1148 | 49 | 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_1148:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0224, 0.0299, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"JSON token scanner\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0448, 0.0149, 0, 0.66, 0.1667, 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_1148:Try_L4_C0", "label": "try", "type": "try", "loc": [4, 7], "level": 0, "parent": null, "vector": [7, 0, 0.0821, 0.0597, 0, 0.66, 0.3333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from simplejson._speedups import make_scanner as c_make_scanner\nexcept ImportError:\n c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:ImportFrom_L5_C4", "label": "from simplejson._speedups import c_make_scanner", "type": "import", "loc": [5, 5], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L4_C0", "vector": [1, 1, 0.0746, 0.0149, 1, 0.76, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_scanner"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_scanner as c_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L7_C4", "label": "c_make_scanner =", "type": "assigned_variable", "loc": [7, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L4_C0", "vector": [14, 1, 0.1045, 0.0149, 1, 0.76, 0.0, 400, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_scanner = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L9_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.1343, 0.0149, 0, 0.66, 0.5, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = ['make_scanner']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L11_C0", "label": "NUMBER_RE = compile()", "type": "assigned_variable", "loc": [11, 13], "level": 0, "parent": null, "vector": [14, 0, 0.1791, 0.0448, 0, 0.66, 0.6667, 566, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "NUMBER_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "NUMBER_RE = re.compile(\n r'(-?(?:0|[1-9]\\d*))(\\.\\d+)?([eE][-+]?\\d+)?',\n (re.VERBOSE | re.MULTILINE | re.DOTALL))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "label": "py_make_scanner", "type": "function", "loc": [15, 65], "level": 0, "parent": null, "vector": [2, 0, 0.597, 0.7612, 0, 0.66, 0.8333, 796, 0, 1, 1, 0, 0, 0, 11], "semantic": {"name": "py_make_scanner", "arg_names": ["context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_make_scanner(context):\n parse_object = context.parse_object\n parse_array = context.parse_array\n parse_string = context.parse_string\n match_number = NUMBER_RE.match\n encoding = context.encoding\n strict = context.strict\n parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L16_C4", "label": "parse_object =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.2388, 0.0149, 1, 0.34, 0.0, 924, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_object", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_object = context.parse_object"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L17_C4", "label": "parse_array =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.2537, 0.0149, 1, 0.34, 0.0833, 676, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_array", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_array = context.parse_array"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L18_C4", "label": "parse_string =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.2687, 0.0149, 1, 0.34, 0.1667, 867, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_string = context.parse_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L19_C4", "label": "match_number =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.2836, 0.0149, 1, 0.34, 0.25, 264, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_number = NUMBER_RE.match"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L20_C4", "label": "encoding =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.2985, 0.0149, 1, 0.34, 0.3333, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " encoding = context.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L21_C4", "label": "strict =", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3134, 0.0149, 1, 0.34, 0.4167, 697, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "strict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " strict = context.strict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L22_C4", "label": "parse_float =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3284, 0.0149, 1, 0.34, 0.5, 475, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_float", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_float = context.parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L23_C4", "label": "parse_int =", "type": "assigned_variable", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3433, 0.0149, 1, 0.34, 0.5833, 31, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_int", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_int = context.parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L24_C4", "label": "parse_constant =", "type": "assigned_variable", "loc": [24, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3582, 0.0149, 1, 0.34, 0.6667, 808, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parse_constant", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parse_constant = context.parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L25_C4", "label": "object_hook =", "type": "assigned_variable", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3731, 0.0149, 1, 0.34, 0.75, 325, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_hook = context.object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L26_C4", "label": "object_pairs_hook =", "type": "assigned_variable", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [14, 1, 0.3881, 0.0149, 1, 0.34, 0.8333, 172, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "object_pairs_hook", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " object_pairs_hook = context.object_pairs_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "label": "_scan_once", "type": "function", "loc": [28, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [2, 1, 0.6791, 0.5373, 1, 0.34, 0.9167, 221, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "_scan_once", "arg_names": ["string", "idx"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _scan_once(string, idx):\n try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration\n\n if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L29_C8", "label": "try", "type": "try", "loc": [29, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "vector": [7, 2, 0.4552, 0.0597, 2, 0.79, 0.0, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n nextchar = string[idx]\n except IndexError:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L30_C12", "label": "nextchar =", "type": "assigned_variable", "loc": [30, 30], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L29_C8", "vector": [14, 3, 0.4478, 0.0149, 3, 0.76, 0.0, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nextchar", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nextchar = string[idx]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8", "label": "if", "type": "if", "loc": [34, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "vector": [4, 2, 0.597, 0.194, 2, 0.79, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nextchar == '\"':\n return parse_string(string, idx + 1, encoding, strict)\n elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict,\n _scan_once, object_hook, object_pairs_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L35_C12", "label": "return", "type": "return", "loc": [35, 35], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8", "vector": [13, 3, 0.5224, 0.0149, 3, 0.22, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_string(string, idx + 1, encoding, strict)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8", "label": "if", "type": "if", "loc": [36, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8", "vector": [4, 3, 0.6119, 0.1642, 3, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '{':\n return parse_object((string, idx + 1), encoding, strict,\n _scan_once, object_hook, object_pairs_hook)\n elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L37_C12", "label": "return", "type": "return", "loc": [37, 38], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8", "vector": [13, 4, 0.5597, 0.0299, 4, 0.38, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_object((string, idx + 1), encoding, strict,\n _scan_once, object_hook, object_pairs_hook)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8", "label": "if", "type": "if", "loc": [39, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8", "vector": [4, 4, 0.6343, 0.1194, 4, 0.38, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '[':\n return parse_array((string, idx + 1), _scan_once)\n elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L40_C12", "label": "return", "type": "return", "loc": [40, 40], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8", "vector": [13, 5, 0.597, 0.0149, 5, 0.58, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_array((string, idx + 1), _scan_once)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8", "label": "if", "type": "if", "loc": [41, 46], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8", "vector": [4, 5, 0.6493, 0.0896, 5, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'n' and string[idx:idx + 4] == 'null':\n return None, idx + 4\n elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L42_C12", "label": "return", "type": "return", "loc": [42, 42], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8", "vector": [13, 6, 0.6269, 0.0149, 6, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return None, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8", "label": "if", "type": "if", "loc": [43, 46], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8", "vector": [4, 6, 0.6642, 0.0597, 6, 0.42, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 't' and string[idx:idx + 4] == 'true':\n return True, idx + 4\n elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L44_C12", "label": "return", "type": "return", "loc": [44, 44], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8", "vector": [13, 7, 0.6567, 0.0149, 7, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return True, idx + 4"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L45_C8", "label": "if", "type": "if", "loc": [45, 46], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8", "vector": [4, 7, 0.6791, 0.0299, 7, 0.01, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'f' and string[idx:idx + 5] == 'false':\n return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L46_C12", "label": "return", "type": "return", "loc": [46, 46], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L45_C8", "vector": [13, 8, 0.6866, 0.0149, 8, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return False, idx + 5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L48_C8", "label": "m = match_number()", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "vector": [14, 2, 0.7164, 0.0149, 2, 0.79, 0.6667, 711, 3, 2, 0, 0, 264, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match_number", "annotation": ""}, "snippet": " m = match_number(string, idx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "label": "if", "type": "if", "loc": [49, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "vector": [4, 2, 0.8358, 0.2239, 2, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m is not None:\n integer, frac, exp = m.groups()\n if frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)\n return res, m.end()\n elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L50_C12", "label": "integer, frac, exp = groups()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "vector": [14, 3, 0.7463, 0.0149, 3, 0.24, 0.0, 563, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "integer, frac, exp", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " integer, frac, exp = m.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12", "label": "if", "type": "if", "loc": [51, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "vector": [4, 3, 0.7836, 0.0597, 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 frac or exp:\n res = parse_float(integer + (frac or '') + (exp or ''))\n else:\n res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L52_C16", "label": "res = parse_float()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12", "vector": [14, 4, 0.7761, 0.0149, 4, 0.82, 0.0, 413, 3, 1, 0, 0, 475, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_float", "annotation": ""}, "snippet": " res = parse_float(integer + (frac or '') + (exp or ''))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L54_C16", "label": "res = parse_int()", "type": "assigned_variable", "loc": [54, 54], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12", "vector": [14, 4, 0.806, 0.0149, 4, 0.82, 1.0, 413, 3, 1, 0, 0, 31, 10, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "parse_int", "annotation": ""}, "snippet": " res = parse_int(integer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "vector": [13, 3, 0.8209, 0.0149, 3, 0.24, 0.6667, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return res, m.end()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8", "label": "if", "type": "if", "loc": [56, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "vector": [4, 3, 0.8881, 0.1194, 3, 0.24, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':\n return parse_constant('NaN'), idx + 3\n elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L57_C12", "label": "return", "type": "return", "loc": [57, 57], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8", "vector": [13, 4, 0.8507, 0.0149, 4, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('NaN'), idx + 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8", "label": "if", "type": "if", "loc": [58, 63], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8", "vector": [4, 4, 0.903, 0.0896, 4, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':\n return parse_constant('Infinity'), idx + 8\n elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L59_C12", "label": "return", "type": "return", "loc": [59, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8", "vector": [13, 5, 0.8806, 0.0149, 5, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('Infinity'), idx + 8"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L60_C8", "label": "if", "type": "if", "loc": [60, 63], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8", "vector": [4, 5, 0.9179, 0.0597, 5, 0.17, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':\n return parse_constant('-Infinity'), idx + 9\n else:\n raise StopIteration"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L61_C12", "label": "return", "type": "return", "loc": [61, 61], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L60_C8", "vector": [13, 6, 0.9104, 0.0149, 6, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parse_constant('-Infinity'), idx + 9"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L65_C4", "label": "return", "type": "return", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "vector": [13, 1, 0.9701, 0.0149, 1, 0.34, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _scan_once"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L67_C0", "label": "make_scanner =", "type": "assigned_variable", "loc": [67, 67], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0149, 0, 0.66, 1.0, 683, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "make_scanner = c_make_scanner or py_make_scanner"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:Try_L29_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L30_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L35_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L34_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L37_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L36_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L40_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L39_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L42_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L44_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L43_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L45_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L46_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L48_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L50_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L52_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L51_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Assign_L54_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L49_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L56_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L59_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L58_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:If_L60_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L61_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1148:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1148:Return_L65_C4"}] |
"""Implementation of JSONEncoder
"""
import re
try:
from _speedups import encode_basestring_ascii as \
c_encode_basestring_ascii
except ImportError:
c_encode_basestring_ascii = None
try:
from _speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
from decoder import PosInf
ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
HAS_UTF8 = re.compile(r'[\x80-\xff]')
ESCAPE_DCT = {
'\\': '\\\\',
'"': '\\"',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
}
for i in range(0x20):
#ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
FLOAT_REPR = repr
def encode_basestring(s):
"""Return a JSON representation of a Python string
"""
if isinstance(s, str) and HAS_UTF8.search(s) is not None:
s = s.decode('utf-8')
def replace(match):
return ESCAPE_DCT[match.group(0)]
return u'"' + ESCAPE.sub(replace, s) + u'"'
def py_encode_basestring_ascii(s):
"""Return an ASCII-only JSON representation of a Python string
"""
if isinstance(s, str) and HAS_UTF8.search(s) is not None:
s = s.decode('utf-8')
def replace(match):
s = match.group(0)
try:
return ESCAPE_DCT[s]
except KeyError:
n = ord(s)
if n < 0x10000:
#return '\\u{0:04x}'.format(n)
return '\\u%04x' % (n,)
else:
# surrogate pair
n -= 0x10000
s1 = 0xd800 | ((n >> 10) & 0x3ff)
s2 = 0xdc00 | (n & 0x3ff)
#return '\\u{0:04x}\\u{1:04x}'.format(s1, s2)
return '\\u%04x\\u%04x' % (s1, s2)
return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
encode_basestring_ascii = (
c_encode_basestring_ascii or py_encode_basestring_ascii)
class JSONEncoder(object):
"""Extensible JSON <http://json.org> encoder for Python data structures.
Supports the following objects and types by default:
+-------------------+---------------+
| Python | JSON |
+===================+===============+
| dict | object |
+-------------------+---------------+
| list, tuple | array |
+-------------------+---------------+
| str, unicode | string |
+-------------------+---------------+
| int, long, float | number |
+-------------------+---------------+
| True | true |
+-------------------+---------------+
| False | false |
+-------------------+---------------+
| None | null |
+-------------------+---------------+
To extend this to recognize other objects, subclass and implement a
``.default()`` method with another method that returns a serializable
object for ``o`` if possible, otherwise it should call the superclass
implementation (to raise ``TypeError``).
"""
item_separator = ', '
key_separator = ': '
def __init__(self, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, encoding='utf-8', default=None):
"""Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt
encoding of keys that are not str, int, long, float or None. If
skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str
objects with all incoming unicode characters escaped. If
ensure_ascii is false, the output will be unicode object.
If check_circular is true, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to
prevent an infinite recursion (which would cause an OverflowError).
Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be
encoded as such. This behavior is not JSON specification compliant,
but is consistent with most JavaScript based encoders and decoders.
Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be
sorted by key; this is useful for regression tests to ensure
that JSON serializations can be compared on a day-to-day basis.
If indent is a string, then JSON array elements and object members
will be pretty-printed with a newline followed by that string repeated
for each level of nesting. ``None`` (the default) selects the most compact
representation without any newlines. For backwards compatibility with
versions of simplejson earlier than 2.1.0, an integer is also accepted
and is converted to a string with that many spaces.
If specified, separators should be a (item_separator, key_separator)
tuple. The default is (', ', ': '). To get the most compact JSON
representation you should specify (',', ':') to eliminate whitespace.
If specified, default is a function that gets called for objects
that can't otherwise be serialized. It should return a JSON encodable
version of the object or raise a ``TypeError``.
If encoding is not None, then all input strings will be
transformed into unicode using that encoding prior to JSON-encoding.
The default is UTF-8.
"""
self.skipkeys = skipkeys
self.ensure_ascii = ensure_ascii
self.check_circular = check_circular
self.allow_nan = allow_nan
self.sort_keys = sort_keys
if isinstance(indent, (int, long)):
indent = ' ' * indent
self.indent = indent
if separators is not None:
self.item_separator, self.key_separator = separators
if default is not None:
self.default = default
self.encoding = encoding
def default(self, o):
"""Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
return JSONEncoder.default(self, o)
"""
raise TypeError(repr(o) + " is not JSON serializable")
def encode(self, o):
"""Return a JSON string representation of a Python data structure.
>>> from simplejson import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
"""
# This is for extremely simple cases and benchmarks.
if isinstance(o, basestring):
if isinstance(o, str):
_encoding = self.encoding
if (_encoding is not None
and not (_encoding == 'utf-8')):
o = o.decode(_encoding)
if self.ensure_ascii:
return encode_basestring_ascii(o)
else:
return encode_basestring(o)
# This doesn't pass the iterator directly to ''.join() because the
# exceptions aren't as detailed. The list call should be roughly
# equivalent to the PySequence_Fast that ''.join() would do.
chunks = self.iterencode(o, _one_shot=True)
if not isinstance(chunks, (list, tuple)):
chunks = list(chunks)
if self.ensure_ascii:
return ''.join(chunks)
else:
return u''.join(chunks)
def iterencode(self, o, _one_shot=False):
"""Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)
"""
if self.check_circular:
markers = {}
else:
markers = None
if self.ensure_ascii:
_encoder = encode_basestring_ascii
else:
_encoder = encode_basestring
if self.encoding != 'utf-8':
def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
if isinstance(o, str):
o = o.decode(_encoding)
return _orig_encoder(o)
def floatstr(o, allow_nan=self.allow_nan,
_repr=FLOAT_REPR, _inf=PosInf, _neginf=-PosInf):
# Check for specials. Note that this type of test is processor
# and/or platform-specific, so do tests which don't depend on
# the internals.
if o != o:
text = 'NaN'
elif o == _inf:
text = 'Infinity'
elif o == _neginf:
text = '-Infinity'
else:
return _repr(o)
if not allow_nan:
raise ValueError(
"Out of range float values are not JSON compliant: " +
repr(o))
return text
if (_one_shot and c_make_encoder is not None
and not self.indent and not self.sort_keys):
_iterencode = c_make_encoder(
markers, self.default, _encoder, self.indent,
self.key_separator, self.item_separator, self.sort_keys,
self.skipkeys, self.allow_nan)
else:
_iterencode = _make_iterencode(
markers, self.default, _encoder, self.indent, floatstr,
self.key_separator, self.item_separator, self.sort_keys,
self.skipkeys, _one_shot)
return _iterencode(o, 0)
def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
_key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
## HACK: hand-optimized bytecode; turn globals into locals
False=False,
True=True,
ValueError=ValueError,
basestring=basestring,
dict=dict,
float=float,
id=id,
int=int,
isinstance=isinstance,
list=list,
long=long,
str=str,
tuple=tuple,
):
def _iterencode_list(lst, _current_indent_level):
if not lst:
yield '[]'
return
if markers is not None:
markerid = id(lst)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = lst
buf = '['
if _indent is not None:
_current_indent_level += 1
newline_indent = '\n' + (_indent * _current_indent_level)
separator = _item_separator + newline_indent
buf += newline_indent
else:
newline_indent = None
separator = _item_separator
first = True
for value in lst:
if first:
first = False
else:
buf = separator
if isinstance(value, basestring):
yield buf + _encoder(value)
elif value is None:
yield buf + 'null'
elif value is True:
yield buf + 'true'
elif value is False:
yield buf + 'false'
elif isinstance(value, (int, long)):
yield buf + str(value)
elif isinstance(value, float):
yield buf + _floatstr(value)
else:
yield buf
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
for chunk in chunks:
yield chunk
if newline_indent is not None:
_current_indent_level -= 1
yield '\n' + (_indent * _current_indent_level)
yield ']'
if markers is not None:
del markers[markerid]
def _iterencode_dict(dct, _current_indent_level):
if not dct:
yield '{}'
return
if markers is not None:
markerid = id(dct)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = dct
yield '{'
if _indent is not None:
_current_indent_level += 1
newline_indent = '\n' + (_indent * _current_indent_level)
item_separator = _item_separator + newline_indent
yield newline_indent
else:
newline_indent = None
item_separator = _item_separator
first = True
if _sort_keys:
items = dct.items()
items.sort(key=lambda kv: kv[0])
else:
items = dct.iteritems()
for key, value in items:
if isinstance(key, basestring):
pass
# JavaScript is weakly typed for these, so it makes sense to
# also allow them. Many encoders seem to do something like this.
elif isinstance(key, float):
key = _floatstr(key)
elif key is True:
key = 'true'
elif key is False:
key = 'false'
elif key is None:
key = 'null'
elif isinstance(key, (int, long)):
key = str(key)
elif _skipkeys:
continue
else:
raise TypeError("key " + repr(key) + " is not a string")
if first:
first = False
else:
yield item_separator
yield _encoder(key)
yield _key_separator
if isinstance(value, basestring):
yield _encoder(value)
elif value is None:
yield 'null'
elif value is True:
yield 'true'
elif value is False:
yield 'false'
elif isinstance(value, (int, long)):
yield str(value)
elif isinstance(value, float):
yield _floatstr(value)
else:
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
for chunk in chunks:
yield chunk
if newline_indent is not None:
_current_indent_level -= 1
yield '\n' + (_indent * _current_indent_level)
yield '}'
if markers is not None:
del markers[markerid]
def _iterencode(o, _current_indent_level):
if isinstance(o, basestring):
yield _encoder(o)
elif o is None:
yield 'null'
elif o is True:
yield 'true'
elif o is False:
yield 'false'
elif isinstance(o, (int, long)):
yield str(o)
elif isinstance(o, float):
yield _floatstr(o)
elif isinstance(o, (list, tuple)):
for chunk in _iterencode_list(o, _current_indent_level):
yield chunk
elif isinstance(o, dict):
for chunk in _iterencode_dict(o, _current_indent_level):
yield chunk
else:
if markers is not None:
markerid = id(o)
if markerid in markers:
raise ValueError("Circular reference detected")
markers[markerid] = o
o = _default(o)
for chunk in _iterencode(o, _current_indent_level):
yield chunk
if markers is not None:
del markers[markerid]
return _iterencode
| ajibawa-2023/Python-Code-Large/train/row_1149 | 236 | 454 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 2], "level": 0, "parent": null, "vector": [8, 0, 0.0033, 0.0044, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Implementation of JSONEncoder\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0066, 0.0022, 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_1149:Try_L5_C0", "label": "try", "type": "try", "loc": [5, 9], "level": 0, "parent": null, "vector": [7, 0, 0.0154, 0.011, 0, 0.66, 0.1333, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from _speedups import encode_basestring_ascii as \\\n c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:ImportFrom_L6_C4", "label": "from _speedups import c_encode_basestring_ascii", "type": "import", "loc": [6, 7], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L5_C0", "vector": [1, 1, 0.0143, 0.0044, 1, 0.21, 0.0, 677, 0, 1, 0, 0, 677, 0, 0], "semantic": {"name": "_speedups", "arg_names": [], "import_names": ["c_encode_basestring_ascii"], "rhs_call_name": "", "annotation": ""}, "snippet": " from _speedups import encode_basestring_ascii as \\\n c_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L9_C4", "label": "c_encode_basestring_ascii =", "type": "assigned_variable", "loc": [9, 9], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L5_C0", "vector": [14, 1, 0.0198, 0.0022, 1, 0.21, 0.0, 485, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_encode_basestring_ascii = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L10_C0", "label": "try", "type": "try", "loc": [10, 13], "level": 0, "parent": null, "vector": [7, 0, 0.0253, 0.0088, 0, 0.66, 0.2, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n from _speedups import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:ImportFrom_L11_C4", "label": "from _speedups import c_make_encoder", "type": "import", "loc": [11, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L10_C0", "vector": [1, 1, 0.0242, 0.0022, 1, 0.23, 0.0, 677, 0, 1, 0, 0, 677, 0, 0], "semantic": {"name": "_speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from _speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L13_C4", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L10_C0", "vector": [14, 1, 0.0286, 0.0022, 1, 0.23, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:ImportFrom_L15_C0", "label": "from decoder import PosInf", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.033, 0.0022, 0, 0.66, 0.2667, 404, 0, 1, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["PosInf"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import PosInf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L17_C0", "label": "ESCAPE = compile()", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.0374, 0.0022, 0, 0.66, 0.3333, 562, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE = re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L18_C0", "label": "ESCAPE_ASCII = compile()", "type": "assigned_variable", "loc": [18, 18], "level": 0, "parent": null, "vector": [14, 0, 0.0396, 0.0022, 0, 0.66, 0.4, 214, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "ESCAPE_ASCII", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "ESCAPE_ASCII = re.compile(r'([\\\\\"]|[^\\ -~])')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L19_C0", "label": "HAS_UTF8 = compile()", "type": "assigned_variable", "loc": [19, 19], "level": 0, "parent": null, "vector": [14, 0, 0.0419, 0.0022, 0, 0.66, 0.4667, 954, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "HAS_UTF8", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "HAS_UTF8 = re.compile(r'[\\x80-\\xff]')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L20_C0", "label": "ESCAPE_DCT =", "type": "assigned_variable", "loc": [20, 28], "level": 0, "parent": null, "vector": [14, 0, 0.0529, 0.0198, 0, 0.66, 0.5333, 404, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ESCAPE_DCT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ESCAPE_DCT = {\n '\\\\': '\\\\\\\\',\n '\"': '\\\\\"',\n '\\b': '\\\\b',\n '\\f': '\\\\f',\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L29_C0", "label": "for i", "type": "for", "loc": [29, 31], "level": 0, "parent": null, "vector": [6, 0, 0.0661, 0.0066, 0, 0.66, 0.6, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for i in range(0x20):\n #ESCAPE_DCT.setdefault(chr(i), '\\\\u{0:04x}'.format(i))\n ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L31_C4", "label": "setdefault()", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L29_C0", "vector": [8, 1, 0.0683, 0.0022, 1, 0.87, 0.0, 262, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "setdefault", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " ESCAPE_DCT.setdefault(chr(i), '\\\\u%04x' % (i,))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L33_C0", "label": "FLOAT_REPR =", "type": "assigned_variable", "loc": [33, 33], "level": 0, "parent": null, "vector": [14, 0, 0.0727, 0.0022, 0, 0.66, 0.6667, 39, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "FLOAT_REPR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FLOAT_REPR = repr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "label": "encode_basestring", "type": "function", "loc": [35, 43], "level": 0, "parent": null, "vector": [2, 0, 0.0859, 0.0198, 0, 0.66, 0.7333, 207, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "encode_basestring", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def encode_basestring(s):\n \"\"\"Return a JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L36_C4", "label": "expression", "type": "expression", "loc": [36, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "vector": [8, 1, 0.0815, 0.0066, 1, 0.92, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L39_C4", "label": "if", "type": "if", "loc": [39, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "vector": [4, 1, 0.087, 0.0044, 1, 0.92, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L40_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L39_C4", "vector": [14, 2, 0.0881, 0.0022, 2, 0.04, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L41_C4", "label": "replace", "type": "function", "loc": [41, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "vector": [2, 1, 0.0914, 0.0044, 1, 0.92, 0.6667, 293, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L42_C8", "label": "return", "type": "return", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L41_C4", "vector": [13, 2, 0.0925, 0.0022, 2, 0.63, 0.0, 0, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[match.group(0)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L43_C4", "label": "return", "type": "return", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "vector": [13, 1, 0.0947, 0.0022, 1, 0.92, 1.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return u'\"' + ESCAPE.sub(replace, s) + u'\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "label": "py_encode_basestring_ascii", "type": "function", "loc": [46, 68], "level": 0, "parent": null, "vector": [2, 0, 0.1256, 0.0507, 0, 0.66, 0.8, 438, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "py_encode_basestring_ascii", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def py_encode_basestring_ascii(s):\n \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\"\n if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')\n def replace(match):\n s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L47_C4", "label": "expression", "type": "expression", "loc": [47, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "vector": [8, 1, 0.1057, 0.0066, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return an ASCII-only JSON representation of a Python string\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L50_C4", "label": "if", "type": "if", "loc": [50, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "vector": [4, 1, 0.1112, 0.0044, 1, 0.61, 0.3333, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(s, str) and HAS_UTF8.search(s) is not None:\n s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L51_C8", "label": "s = decode()", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L50_C4", "vector": [14, 2, 0.1123, 0.0022, 2, 0.45, 0.0, 553, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " s = s.decode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4", "label": "replace", "type": "function", "loc": [52, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "vector": [2, 1, 0.1311, 0.0352, 1, 0.61, 0.6667, 293, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "replace", "arg_names": ["match"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def replace(match):\n s = match.group(0)\n try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n #return '\\\\u{0:04x}'.format(n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L53_C8", "label": "s = group()", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4", "vector": [14, 2, 0.1167, 0.0022, 2, 0.9, 0.0, 553, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " s = match.group(0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "label": "try", "type": "try", "loc": [54, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4", "vector": [7, 2, 0.1333, 0.0308, 2, 0.9, 1.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return ESCAPE_DCT[s]\n except KeyError:\n n = ord(s)\n if n < 0x10000:\n #return '\\\\u{0:04x}'.format(n)\n return '\\\\u%04x' % (n,)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L55_C12", "label": "return", "type": "return", "loc": [55, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "vector": [13, 3, 0.1211, 0.0022, 3, 0.58, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ESCAPE_DCT[s]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L57_C12", "label": "n = ord()", "type": "assigned_variable", "loc": [57, 57], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "vector": [14, 3, 0.1256, 0.0022, 3, 0.58, 0.0, 773, 3, 1, 0, 0, 171, 10, 1], "semantic": {"name": "n", "arg_names": [], "import_names": [], "rhs_call_name": "ord", "annotation": ""}, "snippet": " n = ord(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "label": "if", "type": "if", "loc": [58, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "vector": [4, 3, 0.1377, 0.022, 3, 0.58, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if n < 0x10000:\n #return '\\\\u{0:04x}'.format(n)\n return '\\\\u%04x' % (n,)\n else:\n # surrogate pair\n n -= 0x10000\n s1 = 0xd800 | ((n >> 10) & 0x3ff)\n s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L60_C16", "label": "return", "type": "return", "loc": [60, 60], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "vector": [13, 4, 0.1322, 0.0022, 4, 0.66, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x' % (n,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L64_C16", "label": "s1 =", "type": "assigned_variable", "loc": [64, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "vector": [14, 4, 0.141, 0.0022, 4, 0.66, 0.3333, 745, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s1 = 0xd800 | ((n >> 10) & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L65_C16", "label": "s2 =", "type": "assigned_variable", "loc": [65, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "vector": [14, 4, 0.1432, 0.0022, 4, 0.66, 0.6667, 448, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "s2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " s2 = 0xdc00 | (n & 0x3ff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L67_C16", "label": "return", "type": "return", "loc": [67, 67], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "vector": [13, 4, 0.1476, 0.0022, 4, 0.66, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\\\\u%04x\\\\u%04x' % (s1, s2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L68_C4", "label": "return", "type": "return", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "vector": [13, 1, 0.1498, 0.0022, 1, 0.61, 1.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '\"' + str(ESCAPE_ASCII.sub(replace, s)) + '\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L71_C0", "label": "encode_basestring_ascii =", "type": "assigned_variable", "loc": [71, 72], "level": 0, "parent": null, "vector": [14, 0, 0.1575, 0.0044, 0, 0.66, 0.8667, 105, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "encode_basestring_ascii = (\n c_encode_basestring_ascii or py_encode_basestring_ascii)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "label": "JSONEncoder", "type": "class", "loc": [74, 275], "level": 0, "parent": null, "vector": [3, 0, 0.3844, 0.4449, 0, 0.66, 0.9333, 228, 0, 6, 0, 0, 186, 0, 22], "semantic": {"name": "JSONEncoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class JSONEncoder(object):\n \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L75_C4", "label": "expression", "type": "expression", "loc": [75, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [8, 1, 0.1949, 0.0617, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Extensible JSON <http://json.org> encoder for Python data structures.\n\n Supports the following objects and types by default:\n\n +-------------------+---------------+\n | Python | JSON |\n +===================+===============+\n | dict | object |"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L103_C4", "label": "item_separator =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [14, 1, 0.2269, 0.0022, 1, 0.36, 0.1667, 330, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = ', '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L104_C4", "label": "key_separator =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [14, 1, 0.2291, 0.0022, 1, 0.36, 0.3333, 294, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key_separator = ': '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "label": "__init__", "type": "function", "loc": [105, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [2, 1, 0.2974, 0.1344, 1, 0.36, 0.5, 555, 0, 10, 0, 0, 0, 0, 1], "semantic": {"name": "__init__", "arg_names": ["self", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "sort_keys", "indent", "separators", "encoding", "default"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, skipkeys=False, ensure_ascii=True,\n check_circular=True, allow_nan=True, sort_keys=False,\n indent=None, separators=None, encoding='utf-8', default=None):\n \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is false, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L108_C8", "label": "expression", "type": "expression", "loc": [108, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [8, 2, 0.2852, 0.0969, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor for JSONEncoder, with sensible defaults.\n\n If skipkeys is false, then it is a TypeError to attempt\n encoding of keys that are not str, int, long, float or None. If\n skipkeys is True, such items are simply skipped.\n\n If ensure_ascii is true, the output is guaranteed to be str\n objects with all incoming unicode characters escaped. If"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L153_C8", "label": "self.skipkeys =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.337, 0.0022, 2, 0.71, 0.1, 853, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.skipkeys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.skipkeys = skipkeys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L154_C8", "label": "self.ensure_ascii =", "type": "assigned_variable", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3392, 0.0022, 2, 0.71, 0.2, 255, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.ensure_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.ensure_ascii = ensure_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L155_C8", "label": "self.check_circular =", "type": "assigned_variable", "loc": [155, 155], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3414, 0.0022, 2, 0.71, 0.3, 698, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.check_circular", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.check_circular = check_circular"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L156_C8", "label": "self.allow_nan =", "type": "assigned_variable", "loc": [156, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3436, 0.0022, 2, 0.71, 0.4, 507, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.allow_nan", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.allow_nan = allow_nan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L157_C8", "label": "self.sort_keys =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3458, 0.0022, 2, 0.71, 0.5, 911, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.sort_keys", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.sort_keys = sort_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L158_C8", "label": "if", "type": "if", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [4, 2, 0.3491, 0.0044, 2, 0.71, 0.6, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(indent, (int, long)):\n indent = ' ' * indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L159_C12", "label": "indent =", "type": "assigned_variable", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L158_C8", "vector": [14, 3, 0.3502, 0.0022, 3, 0.03, 0.0, 231, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indent = ' ' * indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L160_C8", "label": "self.indent =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3524, 0.0022, 2, 0.71, 0.7, 771, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.indent = indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L161_C8", "label": "if", "type": "if", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [4, 2, 0.3557, 0.0044, 2, 0.71, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if separators is not None:\n self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L162_C12", "label": "assign", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L161_C8", "vector": [14, 3, 0.3568, 0.0022, 3, 0.65, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.item_separator, self.key_separator = separators"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L163_C8", "label": "if", "type": "if", "loc": [163, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [4, 2, 0.3601, 0.0044, 2, 0.71, 0.9, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if default is not None:\n self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L164_C12", "label": "self.default =", "type": "assigned_variable", "loc": [164, 164], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L163_C8", "vector": [14, 3, 0.3612, 0.0022, 3, 0.1, 0.0, 762, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.default", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.default = default"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L165_C8", "label": "self.encoding =", "type": "assigned_variable", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "vector": [14, 2, 0.3634, 0.0022, 2, 0.71, 1.0, 564, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.encoding = encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L167_C4", "label": "default", "type": "function", "loc": [167, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [2, 1, 0.3877, 0.0419, 1, 0.36, 0.6667, 977, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "default", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def default(self, o):\n \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L168_C8", "label": "expression", "type": "expression", "loc": [168, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L167_C4", "vector": [8, 2, 0.3877, 0.0374, 2, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Implement this method in a subclass such that it returns\n a serializable object for ``o``, or calls the base implementation\n (to raise a ``TypeError``).\n\n For example, to support arbitrary iterators, you could\n implement default like this::\n\n def default(self, o):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "label": "encode", "type": "function", "loc": [187, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [2, 1, 0.4427, 0.0639, 1, 0.36, 0.8333, 623, 0, 2, 1, 0, 0, 0, 10], "semantic": {"name": "encode", "arg_names": ["self", "o"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def encode(self, o):\n \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> from simplejson import JSONEncoder\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L188_C8", "label": "expression", "type": "expression", "loc": [188, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "vector": [8, 2, 0.4207, 0.0154, 2, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a JSON string representation of a Python data structure.\n\n >>> from simplejson import JSONEncoder\n >>> JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n '{\"foo\": [\"bar\", \"baz\"]}'\n\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8", "label": "if", "type": "if", "loc": [196, 205], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "vector": [4, 2, 0.4416, 0.022, 2, 0.78, 0.25, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)\n if self.ensure_ascii:\n return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12", "label": "if", "type": "if", "loc": [197, 201], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8", "vector": [4, 3, 0.4383, 0.011, 3, 0.91, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n _encoding = self.encoding\n if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L198_C16", "label": "_encoding =", "type": "assigned_variable", "loc": [198, 198], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12", "vector": [14, 4, 0.4361, 0.0022, 4, 0.43, 0.0, 410, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoding", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoding = self.encoding"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L199_C16", "label": "if", "type": "if", "loc": [199, 201], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12", "vector": [4, 4, 0.4405, 0.0066, 4, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_encoding is not None\n and not (_encoding == 'utf-8')):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L201_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [201, 201], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L199_C16", "vector": [14, 5, 0.4427, 0.0022, 5, 0.59, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12", "label": "if", "type": "if", "loc": [202, 205], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8", "vector": [4, 3, 0.4482, 0.0088, 3, 0.91, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else:\n return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L203_C16", "label": "return", "type": "return", "loc": [203, 203], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12", "vector": [13, 4, 0.4471, 0.0022, 4, 0.98, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring_ascii(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L205_C16", "label": "return", "type": "return", "loc": [205, 205], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12", "vector": [13, 4, 0.4515, 0.0022, 4, 0.98, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return encode_basestring(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L209_C8", "label": "chunks = iterencode()", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "vector": [14, 2, 0.4604, 0.0022, 2, 0.78, 0.5, 284, 3, 2, 0, 0, 315, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " chunks = self.iterencode(o, _one_shot=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L210_C8", "label": "if", "type": "if", "loc": [210, 211], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "vector": [4, 2, 0.4637, 0.0044, 2, 0.78, 0.75, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not isinstance(chunks, (list, tuple)):\n chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L211_C12", "label": "chunks = list()", "type": "assigned_variable", "loc": [211, 211], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L210_C8", "vector": [14, 3, 0.4648, 0.0022, 3, 0.46, 0.0, 284, 3, 1, 0, 0, 430, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " chunks = list(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8", "label": "if", "type": "if", "loc": [212, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "vector": [4, 2, 0.4703, 0.0088, 2, 0.78, 1.0, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n return ''.join(chunks)\n else:\n return u''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L213_C12", "label": "return", "type": "return", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8", "vector": [13, 3, 0.4692, 0.0022, 3, 0.77, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L215_C12", "label": "return", "type": "return", "loc": [215, 215], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8", "vector": [13, 3, 0.4736, 0.0022, 3, 0.77, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return u''.join(chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "label": "iterencode", "type": "function", "loc": [217, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "vector": [2, 1, 0.5419, 0.13, 1, 0.36, 1.0, 315, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "iterencode", "arg_names": ["self", "o", "_one_shot"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def iterencode(self, o, _one_shot=False):\n \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L218_C8", "label": "expression", "type": "expression", "loc": [218, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [8, 2, 0.489, 0.0198, 2, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Encode the given object and yield each string\n representation as available.\n\n For example::\n\n for chunk in JSONEncoder().iterencode(bigobject):\n mysocket.write(chunk)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8", "label": "if", "type": "if", "loc": [227, 230], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [4, 2, 0.5033, 0.0088, 2, 0.74, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.check_circular:\n markers = {}\n else:\n markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L228_C12", "label": "markers =", "type": "assigned_variable", "loc": [228, 228], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8", "vector": [14, 3, 0.5022, 0.0022, 3, 0.98, 0.0, 586, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L230_C12", "label": "markers =", "type": "assigned_variable", "loc": [230, 230], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8", "vector": [14, 3, 0.5066, 0.0022, 3, 0.98, 1.0, 586, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "markers", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8", "label": "if", "type": "if", "loc": [231, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [4, 2, 0.5121, 0.0088, 2, 0.74, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.ensure_ascii:\n _encoder = encode_basestring_ascii\n else:\n _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L232_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [232, 232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8", "vector": [14, 3, 0.511, 0.0022, 3, 0.4, 0.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L234_C12", "label": "_encoder =", "type": "assigned_variable", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8", "vector": [14, 3, 0.5154, 0.0022, 3, 0.4, 1.0, 153, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " _encoder = encode_basestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L235_C8", "label": "if", "type": "if", "loc": [235, 239], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [4, 2, 0.522, 0.011, 2, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.encoding != 'utf-8':\n def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12", "label": "_encoder", "type": "function", "loc": [236, 239], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L235_C8", "vector": [2, 3, 0.5231, 0.0088, 3, 0.64, 0.0, 153, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_encoder", "arg_names": ["o", "_orig_encoder", "_encoding"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):\n if isinstance(o, str):\n o = o.decode(_encoding)\n return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L237_C16", "label": "if", "type": "if", "loc": [237, 238], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12", "vector": [4, 4, 0.5231, 0.0044, 4, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, str):\n o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L238_C20", "label": "o = decode()", "type": "assigned_variable", "loc": [238, 238], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L237_C16", "vector": [14, 5, 0.5242, 0.0022, 5, 0.63, 0.0, 926, 3, 1, 0, 0, 528, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "decode", "annotation": ""}, "snippet": " o = o.decode(_encoding)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L239_C16", "label": "return", "type": "return", "loc": [239, 239], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12", "vector": [13, 4, 0.5264, 0.0022, 4, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _orig_encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "label": "floatstr", "type": "function", "loc": [241, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [2, 2, 0.5529, 0.0463, 2, 0.74, 0.6667, 122, 0, 5, 1, 0, 0, 0, 3], "semantic": {"name": "floatstr", "arg_names": ["o", "allow_nan", "_repr", "_inf", "_neginf"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def floatstr(o, allow_nan=self.allow_nan,\n _repr=FLOAT_REPR, _inf=PosInf, _neginf=-PosInf):\n # Check for specials. Note that this type of test is processor\n # and/or platform-specific, so do tests which don't depend on\n # the internals.\n\n if o != o:\n text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12", "label": "if", "type": "if", "loc": [247, 254], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "vector": [4, 3, 0.5518, 0.0176, 3, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if o != o:\n text = 'NaN'\n elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L248_C16", "label": "text =", "type": "assigned_variable", "loc": [248, 248], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12", "vector": [14, 4, 0.5463, 0.0022, 4, 0.87, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'NaN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12", "label": "if", "type": "if", "loc": [249, 254], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12", "vector": [4, 4, 0.554, 0.0132, 4, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _inf:\n text = 'Infinity'\n elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L250_C16", "label": "text =", "type": "assigned_variable", "loc": [250, 250], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12", "vector": [14, 5, 0.5507, 0.0022, 5, 0.78, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = 'Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12", "label": "if", "type": "if", "loc": [251, 254], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12", "vector": [4, 5, 0.5562, 0.0088, 5, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o == _neginf:\n text = '-Infinity'\n else:\n return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L252_C16", "label": "text =", "type": "assigned_variable", "loc": [252, 252], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12", "vector": [14, 6, 0.5551, 0.0022, 6, 0.85, 0.0, 439, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = '-Infinity'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L254_C16", "label": "return", "type": "return", "loc": [254, 254], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12", "vector": [13, 6, 0.5595, 0.0022, 6, 0.85, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _repr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L256_C12", "label": "if", "type": "if", "loc": [256, 259], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "vector": [4, 3, 0.5672, 0.0088, 3, 0.93, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not allow_nan:\n raise ValueError(\n \"Out of range float values are not JSON compliant: \" +\n repr(o))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L261_C12", "label": "return", "type": "return", "loc": [261, 261], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "vector": [13, 3, 0.5749, 0.0022, 3, 0.93, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8", "label": "if", "type": "if", "loc": [264, 274], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [4, 2, 0.5925, 0.0242, 2, 0.74, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (_one_shot and c_make_encoder is not None\n and not self.indent and not self.sort_keys):\n _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)\n else:\n _iterencode = _make_iterencode("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L266_C12", "label": "_iterencode = c_make_encoder()", "type": "assigned_variable", "loc": [266, 269], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8", "vector": [14, 3, 0.5892, 0.0088, 3, 0.02, 0.0, 136, 3, 9, 0, 0, 30, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "c_make_encoder", "annotation": ""}, "snippet": " _iterencode = c_make_encoder(\n markers, self.default, _encoder, self.indent,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, self.allow_nan)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L271_C12", "label": "_iterencode = _make_iterencode()", "type": "assigned_variable", "loc": [271, 274], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8", "vector": [14, 3, 0.6002, 0.0088, 3, 0.02, 1.0, 136, 3, 10, 0, 0, 845, 10, 1], "semantic": {"name": "_iterencode", "arg_names": [], "import_names": [], "rhs_call_name": "_make_iterencode", "annotation": ""}, "snippet": " _iterencode = _make_iterencode(\n markers, self.default, _encoder, self.indent, floatstr,\n self.key_separator, self.item_separator, self.sort_keys,\n self.skipkeys, _one_shot)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L275_C8", "label": "return", "type": "return", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "vector": [13, 2, 0.6057, 0.0022, 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 _iterencode(o, 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "label": "_make_iterencode", "type": "function", "loc": [277, 454], "level": 0, "parent": null, "vector": [2, 0, 0.8051, 0.3921, 0, 0.66, 1.0, 845, 0, 21, 1, 0, 0, 0, 51], "semantic": {"name": "_make_iterencode", "arg_names": ["markers", "_default", "_encoder", "_indent", "_floatstr", "_key_separator", "_item_separator", "_sort_keys", "_skipkeys", "_one_shot", "ValueError", "basestring", "dict", "float", "id", "int", "isinstance", "list", "long", "str", "tuple"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,\n _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,\n ## HACK: hand-optimized bytecode; turn globals into locals\n ValueError=ValueError,\n basestring=basestring,\n dict=dict,\n float=float,\n id=id,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "label": "_iterencode_list", "type": "function", "loc": [293, 344], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "vector": [2, 1, 0.7015, 0.1145, 1, 0.24, 0.0, 1, 0, 2, 0, 0, 0, 0, 13], "semantic": {"name": "_iterencode_list", "arg_names": ["lst", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_list(lst, _current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8", "label": "if", "type": "if", "loc": [294, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [4, 2, 0.6498, 0.0066, 2, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not lst:\n yield '[]'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L295_C12", "label": "expression", "type": "expression", "loc": [295, 295], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8", "vector": [8, 3, 0.6498, 0.0022, 3, 0.68, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '[]'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L296_C12", "label": "return", "type": "return", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8", "vector": [13, 3, 0.652, 0.0022, 3, 0.68, 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_1149:If_L297_C8", "label": "if", "type": "if", "loc": [297, 301], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [4, 2, 0.6586, 0.011, 2, 0.09, 0.125, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L298_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [298, 298], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "vector": [14, 3, 0.6564, 0.0022, 3, 0.22, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(lst)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L299_C12", "label": "if", "type": "if", "loc": [299, 300], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "vector": [4, 3, 0.6597, 0.0044, 3, 0.22, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L301_C12", "label": "assign", "type": "assigned_variable", "loc": [301, 301], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "vector": [14, 3, 0.663, 0.0022, 3, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = lst"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L302_C8", "label": "buf =", "type": "assigned_variable", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [14, 2, 0.6652, 0.0022, 2, 0.09, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = '['"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "label": "if", "type": "if", "loc": [303, 310], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [4, 2, 0.6751, 0.0176, 2, 0.09, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (_indent * _current_indent_level)\n separator = _item_separator + newline_indent\n buf += newline_indent\n else:\n newline_indent = None\n separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L305_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [305, 305], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "vector": [14, 3, 0.6718, 0.0022, 3, 0.21, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L306_C12", "label": "separator =", "type": "assigned_variable", "loc": [306, 306], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "vector": [14, 3, 0.674, 0.0022, 3, 0.21, 0.3333, 539, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L309_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [309, 309], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "vector": [14, 3, 0.6806, 0.0022, 3, 0.21, 0.6667, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L310_C12", "label": "separator =", "type": "assigned_variable", "loc": [310, 310], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "vector": [14, 3, 0.6828, 0.0022, 3, 0.21, 1.0, 539, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L311_C8", "label": "first =", "type": "assigned_variable", "loc": [311, 311], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [14, 2, 0.685, 0.0022, 2, 0.09, 0.5, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8", "label": "for value", "type": "for", "loc": [312, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [6, 2, 0.7159, 0.0595, 2, 0.09, 0.625, 441, 2, 0, 0, 0, 0, 0, 11], "semantic": {"name": "value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for value in lst:\n if first:\n first = False\n else:\n buf = separator\n if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12", "label": "if", "type": "if", "loc": [313, 316], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8", "vector": [4, 3, 0.6927, 0.0088, 3, 0.54, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L314_C16", "label": "first =", "type": "assigned_variable", "loc": [314, 314], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12", "vector": [14, 4, 0.6916, 0.0022, 4, 0.79, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L316_C16", "label": "buf =", "type": "assigned_variable", "loc": [316, 316], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12", "vector": [14, 4, 0.696, 0.0022, 4, 0.79, 1.0, 840, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12", "label": "if", "type": "if", "loc": [317, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8", "vector": [4, 3, 0.7214, 0.0485, 3, 0.54, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield buf + _encoder(value)\n elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L318_C16", "label": "expression", "type": "expression", "loc": [318, 318], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12", "vector": [8, 4, 0.7004, 0.0022, 4, 0.75, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12", "label": "if", "type": "if", "loc": [319, 338], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12", "vector": [4, 4, 0.7236, 0.0441, 4, 0.75, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield buf + 'null'\n elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L320_C16", "label": "expression", "type": "expression", "loc": [320, 320], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12", "vector": [8, 5, 0.7048, 0.0022, 5, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12", "label": "if", "type": "if", "loc": [321, 338], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12", "vector": [4, 5, 0.7258, 0.0396, 5, 0.0, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield buf + 'true'\n elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L322_C16", "label": "expression", "type": "expression", "loc": [322, 322], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12", "vector": [8, 6, 0.7093, 0.0022, 6, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12", "label": "if", "type": "if", "loc": [323, 338], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12", "vector": [4, 6, 0.728, 0.0352, 6, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield buf + 'false'\n elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L324_C16", "label": "expression", "type": "expression", "loc": [324, 324], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12", "vector": [8, 7, 0.7137, 0.0022, 7, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12", "label": "if", "type": "if", "loc": [325, 338], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12", "vector": [4, 7, 0.7302, 0.0308, 7, 0.15, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield buf + str(value)\n elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L326_C16", "label": "expression", "type": "expression", "loc": [326, 326], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12", "vector": [8, 8, 0.7181, 0.0022, 8, 0.58, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "label": "if", "type": "if", "loc": [327, 338], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12", "vector": [4, 8, 0.7324, 0.0264, 8, 0.58, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield buf + _floatstr(value)\n else:\n yield buf\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L328_C16", "label": "expression", "type": "expression", "loc": [328, 328], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "vector": [8, 9, 0.7225, 0.0022, 9, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf + _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L330_C16", "label": "expression", "type": "expression", "loc": [330, 330], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "vector": [8, 9, 0.7269, 0.0022, 9, 0.17, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield buf"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16", "label": "if", "type": "if", "loc": [331, 336], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "vector": [4, 9, 0.7346, 0.0132, 9, 0.17, 0.6667, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L332_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [332, 332], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16", "vector": [14, 10, 0.7313, 0.0022, 10, 0.67, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16", "label": "if", "type": "if", "loc": [333, 336], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16", "vector": [4, 10, 0.7368, 0.0088, 10, 0.67, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L334_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [334, 334], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16", "vector": [14, 11, 0.7357, 0.0022, 11, 0.78, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L336_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [336, 336], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16", "vector": [14, 11, 0.7401, 0.0022, 11, 0.78, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L337_C16", "label": "for chunk", "type": "for", "loc": [337, 338], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "vector": [6, 9, 0.7434, 0.0044, 9, 0.17, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L338_C20", "label": "expression", "type": "expression", "loc": [338, 338], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L337_C16", "vector": [8, 10, 0.7445, 0.0022, 10, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L339_C8", "label": "if", "type": "if", "loc": [339, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [4, 2, 0.7489, 0.0066, 2, 0.09, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L341_C12", "label": "expression", "type": "expression", "loc": [341, 341], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L339_C8", "vector": [8, 3, 0.7511, 0.0022, 3, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L342_C8", "label": "expression", "type": "expression", "loc": [342, 342], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [8, 2, 0.7533, 0.0022, 2, 0.09, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ']'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L343_C8", "label": "if", "type": "if", "loc": [343, 344], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "vector": [4, 2, 0.7566, 0.0044, 2, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "label": "_iterencode_dict", "type": "function", "loc": [346, 421], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "vector": [2, 1, 0.8447, 0.1674, 1, 0.24, 0.3333, 301, 0, 2, 0, 0, 0, 0, 24], "semantic": {"name": "_iterencode_dict", "arg_names": ["dct", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode_dict(dct, _current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8", "label": "if", "type": "if", "loc": [347, 349], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.7665, 0.0066, 2, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not dct:\n yield '{}'\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L348_C12", "label": "expression", "type": "expression", "loc": [348, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8", "vector": [8, 3, 0.7665, 0.0022, 3, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L349_C12", "label": "return", "type": "return", "loc": [349, 349], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8", "vector": [13, 3, 0.7687, 0.0022, 3, 0.44, 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_1149:If_L350_C8", "label": "if", "type": "if", "loc": [350, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.7753, 0.011, 2, 0.44, 0.1111, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L351_C12", "label": "markerid = id()", "type": "assigned_variable", "loc": [351, 351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "vector": [14, 3, 0.7731, 0.0022, 3, 0.32, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(dct)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L352_C12", "label": "if", "type": "if", "loc": [352, 353], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "vector": [4, 3, 0.7764, 0.0044, 3, 0.32, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L354_C12", "label": "assign", "type": "assigned_variable", "loc": [354, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "vector": [14, 3, 0.7797, 0.0022, 3, 0.32, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = dct"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L355_C8", "label": "expression", "type": "expression", "loc": [355, 355], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [8, 2, 0.7819, 0.0022, 2, 0.44, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '{'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "label": "if", "type": "if", "loc": [356, 363], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.7919, 0.0176, 2, 0.44, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _indent is not None:\n _current_indent_level += 1\n newline_indent = '\\n' + (_indent * _current_indent_level)\n item_separator = _item_separator + newline_indent\n yield newline_indent\n else:\n newline_indent = None\n item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L358_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [358, 358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "vector": [14, 3, 0.7885, 0.0022, 3, 0.02, 0.0, 810, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L359_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [359, 359], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "vector": [14, 3, 0.7907, 0.0022, 3, 0.02, 0.25, 330, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator + newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L360_C12", "label": "expression", "type": "expression", "loc": [360, 360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "vector": [8, 3, 0.793, 0.0022, 3, 0.02, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield newline_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L362_C12", "label": "newline_indent =", "type": "assigned_variable", "loc": [362, 362], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "vector": [14, 3, 0.7974, 0.0022, 3, 0.02, 0.75, 810, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "newline_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newline_indent = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L363_C12", "label": "item_separator =", "type": "assigned_variable", "loc": [363, 363], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "vector": [14, 3, 0.7996, 0.0022, 3, 0.02, 1.0, 330, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "item_separator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " item_separator = _item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L364_C8", "label": "first =", "type": "assigned_variable", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [14, 2, 0.8018, 0.0022, 2, 0.44, 0.4444, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "label": "if", "type": "if", "loc": [365, 369], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.8084, 0.011, 2, 0.44, 0.5556, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if _sort_keys:\n items = dct.items()\n items.sort(key=lambda kv: kv[0])\n else:\n items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L366_C12", "label": "items = items()", "type": "assigned_variable", "loc": [366, 366], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "vector": [14, 3, 0.8062, 0.0022, 3, 0.91, 0.0, 339, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " items = dct.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L367_C12", "label": "sort()", "type": "expression", "loc": [367, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "vector": [8, 3, 0.8084, 0.0022, 3, 0.91, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " items.sort(key=lambda kv: kv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L369_C12", "label": "items = iteritems()", "type": "assigned_variable", "loc": [369, 369], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "vector": [14, 3, 0.8128, 0.0022, 3, 0.91, 1.0, 339, 3, 0, 0, 0, 252, 10, 1], "semantic": {"name": "items", "arg_names": [], "import_names": [], "rhs_call_name": "iteritems", "annotation": ""}, "snippet": " items = dct.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "label": "for key, value", "type": "for", "loc": [370, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [6, 2, 0.8645, 0.1013, 2, 0.44, 0.6667, 839, 2, 0, 0, 0, 0, 0, 19], "semantic": {"name": "key, value", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, value in items:\n if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif key is True:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L371_C12", "label": "if", "type": "if", "loc": [371, 388], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "vector": [4, 3, 0.8359, 0.0396, 3, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(key, basestring):\n pass\n # JavaScript is weakly typed for these, so it makes sense to\n # also allow them. Many encoders seem to do something like this.\n elif isinstance(key, float):\n key = _floatstr(key)\n elif key is True:\n key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12", "label": "if", "type": "if", "loc": [375, 388], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L371_C12", "vector": [4, 4, 0.8403, 0.0308, 4, 0.61, 0.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, float):\n key = _floatstr(key)\n elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L376_C16", "label": "key = _floatstr()", "type": "assigned_variable", "loc": [376, 376], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12", "vector": [14, 5, 0.8282, 0.0022, 5, 0.73, 0.0, 230, 3, 1, 0, 0, 185, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "_floatstr", "annotation": ""}, "snippet": " key = _floatstr(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12", "label": "if", "type": "if", "loc": [377, 388], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12", "vector": [4, 5, 0.8425, 0.0264, 5, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is True:\n key = 'true'\n elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif isinstance(key, (int, long)):\n key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L378_C16", "label": "key =", "type": "assigned_variable", "loc": [378, 378], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12", "vector": [14, 6, 0.8326, 0.0022, 6, 0.97, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12", "label": "if", "type": "if", "loc": [379, 388], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12", "vector": [4, 6, 0.8447, 0.022, 6, 0.97, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is False:\n key = 'false'\n elif key is None:\n key = 'null'\n elif isinstance(key, (int, long)):\n key = str(key)\n elif _skipkeys:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L380_C16", "label": "key =", "type": "assigned_variable", "loc": [380, 380], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12", "vector": [14, 7, 0.837, 0.0022, 7, 0.68, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12", "label": "if", "type": "if", "loc": [381, 388], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12", "vector": [4, 7, 0.8469, 0.0176, 7, 0.68, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif key is None:\n key = 'null'\n elif isinstance(key, (int, long)):\n key = str(key)\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key \" + repr(key) + \" is not a string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L382_C16", "label": "key =", "type": "assigned_variable", "loc": [382, 382], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12", "vector": [14, 8, 0.8414, 0.0022, 8, 0.74, 0.0, 230, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12", "label": "if", "type": "if", "loc": [383, 388], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12", "vector": [4, 8, 0.8491, 0.0132, 8, 0.74, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(key, (int, long)):\n key = str(key)\n elif _skipkeys:\n continue\n else:\n raise TypeError(\"key \" + repr(key) + \" is not a string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L384_C16", "label": "key = str()", "type": "assigned_variable", "loc": [384, 384], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12", "vector": [14, 9, 0.8458, 0.0022, 9, 0.7, 0.0, 230, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " key = str(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L385_C12", "label": "if", "type": "if", "loc": [385, 388], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12", "vector": [4, 9, 0.8513, 0.0088, 9, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif _skipkeys:\n continue\n else:\n raise TypeError(\"key \" + repr(key) + \" is not a string\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12", "label": "if", "type": "if", "loc": [389, 392], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "vector": [4, 3, 0.8601, 0.0088, 3, 0.99, 0.25, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if first:\n first = False\n else:\n yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L390_C16", "label": "first =", "type": "assigned_variable", "loc": [390, 390], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12", "vector": [14, 4, 0.859, 0.0022, 4, 0.26, 0.0, 199, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "first", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " first = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L392_C16", "label": "expression", "type": "expression", "loc": [392, 392], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12", "vector": [8, 4, 0.8634, 0.0022, 4, 0.26, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield item_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L393_C12", "label": "expression", "type": "expression", "loc": [393, 393], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "vector": [8, 3, 0.8656, 0.0022, 3, 0.99, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L394_C12", "label": "expression", "type": "expression", "loc": [394, 394], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "vector": [8, 3, 0.8678, 0.0022, 3, 0.99, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _key_separator"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12", "label": "if", "type": "if", "loc": [395, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "vector": [4, 3, 0.8921, 0.0463, 3, 0.99, 1.0, 0, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, basestring):\n yield _encoder(value)\n elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L396_C16", "label": "expression", "type": "expression", "loc": [396, 396], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12", "vector": [8, 4, 0.8722, 0.0022, 4, 0.28, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12", "label": "if", "type": "if", "loc": [397, 415], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12", "vector": [4, 4, 0.8943, 0.0419, 4, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is None:\n yield 'null'\n elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L398_C16", "label": "expression", "type": "expression", "loc": [398, 398], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12", "vector": [8, 5, 0.8767, 0.0022, 5, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12", "label": "if", "type": "if", "loc": [399, 415], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12", "vector": [4, 5, 0.8965, 0.0374, 5, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is True:\n yield 'true'\n elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L400_C16", "label": "expression", "type": "expression", "loc": [400, 400], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12", "vector": [8, 6, 0.8811, 0.0022, 6, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12", "label": "if", "type": "if", "loc": [401, 415], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12", "vector": [4, 6, 0.8987, 0.033, 6, 0.13, 1.0, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif value is False:\n yield 'false'\n elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L402_C16", "label": "expression", "type": "expression", "loc": [402, 402], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12", "vector": [8, 7, 0.8855, 0.0022, 7, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12", "label": "if", "type": "if", "loc": [403, 415], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12", "vector": [4, 7, 0.9009, 0.0286, 7, 0.82, 1.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, (int, long)):\n yield str(value)\n elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L404_C16", "label": "expression", "type": "expression", "loc": [404, 404], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12", "vector": [8, 8, 0.8899, 0.0022, 8, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "label": "if", "type": "if", "loc": [405, 415], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12", "vector": [4, 8, 0.9031, 0.0242, 8, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, float):\n yield _floatstr(value)\n else:\n if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L406_C16", "label": "expression", "type": "expression", "loc": [406, 406], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "vector": [8, 9, 0.8943, 0.0022, 9, 0.31, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(value)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16", "label": "if", "type": "if", "loc": [408, 413], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "vector": [4, 9, 0.9042, 0.0132, 9, 0.31, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(value, (list, tuple)):\n chunks = _iterencode_list(value, _current_indent_level)\n elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L409_C20", "label": "chunks = _iterencode_list()", "type": "assigned_variable", "loc": [409, 409], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16", "vector": [14, 10, 0.9009, 0.0022, 10, 0.57, 0.0, 284, 3, 2, 0, 0, 1, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_list", "annotation": ""}, "snippet": " chunks = _iterencode_list(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16", "label": "if", "type": "if", "loc": [410, 413], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16", "vector": [4, 10, 0.9064, 0.0088, 10, 0.57, 1.0, 0, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(value, dict):\n chunks = _iterencode_dict(value, _current_indent_level)\n else:\n chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L411_C20", "label": "chunks = _iterencode_dict()", "type": "assigned_variable", "loc": [411, 411], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16", "vector": [14, 11, 0.9053, 0.0022, 11, 0.61, 0.0, 284, 3, 2, 0, 0, 301, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode_dict", "annotation": ""}, "snippet": " chunks = _iterencode_dict(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L413_C20", "label": "chunks = _iterencode()", "type": "assigned_variable", "loc": [413, 413], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16", "vector": [14, 11, 0.9097, 0.0022, 11, 0.61, 1.0, 284, 3, 2, 0, 0, 136, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "_iterencode", "annotation": ""}, "snippet": " chunks = _iterencode(value, _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L414_C16", "label": "for chunk", "type": "for", "loc": [414, 415], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "vector": [6, 9, 0.913, 0.0044, 9, 0.31, 1.0, 637, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in chunks:\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L415_C20", "label": "expression", "type": "expression", "loc": [415, 415], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L414_C16", "vector": [8, 10, 0.9141, 0.0022, 10, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L416_C8", "label": "if", "type": "if", "loc": [416, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.9185, 0.0066, 2, 0.44, 0.7778, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if newline_indent is not None:\n _current_indent_level -= 1\n yield '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L418_C12", "label": "expression", "type": "expression", "loc": [418, 418], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L416_C8", "vector": [8, 3, 0.9207, 0.0022, 3, 0.19, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '\\n' + (_indent * _current_indent_level)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L419_C8", "label": "expression", "type": "expression", "loc": [419, 419], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [8, 2, 0.9229, 0.0022, 2, 0.44, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L420_C8", "label": "if", "type": "if", "loc": [420, 421], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "vector": [4, 2, 0.9262, 0.0044, 2, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L423_C4", "label": "_iterencode", "type": "function", "loc": [423, 452], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "vector": [2, 1, 0.9637, 0.0661, 1, 0.24, 0.6667, 136, 0, 2, 0, 0, 0, 0, 14], "semantic": {"name": "_iterencode", "arg_names": ["o", "_current_indent_level"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _iterencode(o, _current_indent_level):\n if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8", "label": "if", "type": "if", "loc": [424, 452], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L423_C4", "vector": [4, 2, 0.9648, 0.0639, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 0, 14], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(o, basestring):\n yield _encoder(o)\n elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L425_C12", "label": "expression", "type": "expression", "loc": [425, 425], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8", "vector": [8, 3, 0.9361, 0.0022, 3, 0.56, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _encoder(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8", "label": "if", "type": "if", "loc": [426, 452], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8", "vector": [4, 3, 0.967, 0.0595, 3, 0.56, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is None:\n yield 'null'\n elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L427_C12", "label": "expression", "type": "expression", "loc": [427, 427], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8", "vector": [8, 4, 0.9405, 0.0022, 4, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'null'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8", "label": "if", "type": "if", "loc": [428, 452], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8", "vector": [4, 4, 0.9692, 0.0551, 4, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is True:\n yield 'true'\n elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L429_C12", "label": "expression", "type": "expression", "loc": [429, 429], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8", "vector": [8, 5, 0.9449, 0.0022, 5, 0.44, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'true'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8", "label": "if", "type": "if", "loc": [430, 452], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8", "vector": [4, 5, 0.9714, 0.0507, 5, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif o is False:\n yield 'false'\n elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L431_C12", "label": "expression", "type": "expression", "loc": [431, 431], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8", "vector": [8, 6, 0.9493, 0.0022, 6, 0.62, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'false'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8", "label": "if", "type": "if", "loc": [432, 452], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8", "vector": [4, 6, 0.9736, 0.0463, 6, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (int, long)):\n yield str(o)\n elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L433_C12", "label": "expression", "type": "expression", "loc": [433, 433], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8", "vector": [8, 7, 0.9537, 0.0022, 7, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield str(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8", "label": "if", "type": "if", "loc": [434, 452], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8", "vector": [4, 7, 0.9758, 0.0419, 7, 0.29, 1.0, 0, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, float):\n yield _floatstr(o)\n elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L435_C12", "label": "expression", "type": "expression", "loc": [435, 435], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8", "vector": [8, 8, 0.9581, 0.0022, 8, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield _floatstr(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8", "label": "if", "type": "if", "loc": [436, 452], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8", "vector": [4, 8, 0.978, 0.0374, 8, 0.38, 1.0, 0, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, (list, tuple)):\n for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk\n elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L437_C12", "label": "for chunk", "type": "for", "loc": [437, 438], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8", "vector": [6, 9, 0.9637, 0.0044, 9, 0.56, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_list(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L438_C16", "label": "expression", "type": "expression", "loc": [438, 438], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L437_C12", "vector": [8, 10, 0.9648, 0.0022, 10, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "label": "if", "type": "if", "loc": [439, 452], "level": 9, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8", "vector": [4, 9, 0.9813, 0.0308, 9, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(o, dict):\n for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk\n else:\n if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L440_C12", "label": "for chunk", "type": "for", "loc": [440, 441], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "vector": [6, 10, 0.9703, 0.0044, 10, 0.82, 0.0, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode_dict(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L441_C16", "label": "expression", "type": "expression", "loc": [441, 441], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L440_C12", "vector": [8, 11, 0.9714, 0.0022, 11, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "label": "if", "type": "if", "loc": [443, 447], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "vector": [4, 10, 0.9802, 0.011, 10, 0.82, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n markerid = id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L444_C16", "label": "markerid = id()", "type": "assigned_variable", "loc": [444, 444], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "vector": [14, 11, 0.978, 0.0022, 11, 0.75, 0.0, 105, 3, 1, 0, 0, 941, 10, 1], "semantic": {"name": "markerid", "arg_names": [], "import_names": [], "rhs_call_name": "id", "annotation": ""}, "snippet": " markerid = id(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L445_C16", "label": "if", "type": "if", "loc": [445, 446], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "vector": [4, 11, 0.9813, 0.0044, 11, 0.75, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markerid in markers:\n raise ValueError(\"Circular reference detected\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L447_C16", "label": "assign", "type": "assigned_variable", "loc": [447, 447], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "vector": [14, 11, 0.9846, 0.0022, 11, 0.75, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " markers[markerid] = o"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L448_C12", "label": "o = _default()", "type": "assigned_variable", "loc": [448, 448], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "vector": [14, 10, 0.9868, 0.0022, 10, 0.82, 0.5, 926, 3, 1, 0, 0, 99, 10, 1], "semantic": {"name": "o", "arg_names": [], "import_names": [], "rhs_call_name": "_default", "annotation": ""}, "snippet": " o = _default(o)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L449_C12", "label": "for chunk", "type": "for", "loc": [449, 450], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "vector": [6, 10, 0.9901, 0.0044, 10, 0.82, 0.75, 637, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in _iterencode(o, _current_indent_level):\n yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L450_C16", "label": "expression", "type": "expression", "loc": [450, 450], "level": 11, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L449_C12", "vector": [8, 11, 0.9912, 0.0022, 11, 0.89, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield chunk"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L451_C12", "label": "if", "type": "if", "loc": [451, 452], "level": 10, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "vector": [4, 10, 0.9945, 0.0044, 10, 0.82, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if markers is not None:\n del markers[markerid]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L454_C4", "label": "return", "type": "return", "loc": [454, 454], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "vector": [13, 1, 1.0, 0.0022, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _iterencode"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:ImportFrom_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:ImportFrom_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L31_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L35_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L50_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L51_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L53_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L52_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L55_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L57_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:Try_L54_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L60_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L64_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L65_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L58_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L67_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L46_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L108_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L153_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L155_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L156_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L158_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L159_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L161_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L162_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L163_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L163_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L164_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L167_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L167_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L168_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L188_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L198_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L197_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L199_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L199_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L201_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L196_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L203_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L202_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L205_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L209_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L210_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L210_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L211_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L213_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L212_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L215_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:ClassDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L228_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L227_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L230_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L232_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L231_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L235_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L237_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L237_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L238_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L236_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L239_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L248_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L247_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L250_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L249_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L252_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L251_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L254_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L256_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L241_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L261_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L266_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L264_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L271_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L217_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L295_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L294_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L298_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L299_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L297_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L301_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L305_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L306_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L309_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L303_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L310_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L311_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L314_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L313_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L316_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L312_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L318_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L317_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L320_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L319_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L322_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L321_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L324_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L323_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L326_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L325_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L328_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L330_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L332_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L331_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L334_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L333_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L336_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L327_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L337_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L337_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L338_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L339_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L341_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L342_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L293_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L343_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L348_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L347_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L349_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L352_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L350_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L354_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L355_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L358_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L359_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L360_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L362_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L356_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L363_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L366_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L367_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L365_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L369_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L371_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L371_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L376_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L375_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L378_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L377_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L380_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L379_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L382_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L381_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L384_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L383_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L385_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L390_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L389_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L392_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L393_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L394_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L370_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L396_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L395_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L398_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L397_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L400_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L399_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L402_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L401_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L404_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L403_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L406_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L409_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L408_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L411_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L410_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L413_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L405_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L414_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L414_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L415_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L416_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L416_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L418_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L346_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L420_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L423_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L423_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L425_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L424_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L427_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L426_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L429_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L428_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L431_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L430_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L433_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L432_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L435_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L434_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L437_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L437_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L438_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L436_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L440_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L440_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L441_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L444_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L445_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L443_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L447_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Assign_L448_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L449_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:For_L449_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Expr_L450_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L439_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:If_L451_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1149:FunctionDef_L277_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1149:Return_L454_C4"}] |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of the :mod:`json` library contained in Python 2.6, but maintains
compatibility with Python 2.4 and Python 2.5 and (currently) has
significant performance advantages, even without using the optional C
extension for speedups.
Encoding basic Python object hierarchies::
>>> import simplejson as json
>>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
'["foo", {"bar": ["baz", null, 1.0, 2]}]'
>>> print json.dumps("\"foo\bar")
"\"foo\bar"
>>> print json.dumps(u'\u1234')
"\u1234"
>>> print json.dumps('\\')
"\\"
>>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
{"a": 0, "b": 0, "c": 0}
>>> from StringIO import StringIO
>>> io = StringIO()
>>> json.dump(['streaming API'], io)
>>> io.getvalue()
'["streaming API"]'
Compact encoding::
>>> import simplejson as json
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',',':'))
'[1,2,3,{"4":5,"6":7}]'
Pretty printing::
>>> import simplejson as json
>>> s = json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=' ')
>>> print '\n'.join([l.rstrip() for l in s.splitlines()])
{
"4": 5,
"6": 7
}
Decoding JSON::
>>> import simplejson as json
>>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
>>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
True
>>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
True
>>> from StringIO import StringIO
>>> io = StringIO('["streaming API"]')
>>> json.load(io)[0] == 'streaming API'
True
Specializing JSON object decoding::
>>> import simplejson as json
>>> def as_complex(dct):
... if '__complex__' in dct:
... return complex(dct['real'], dct['imag'])
... return dct
...
>>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
... object_hook=as_complex)
(1+2j)
>>> from decimal import Decimal
>>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
True
Specializing JSON object encoding::
>>> import simplejson as json
>>> def encode_complex(obj):
... if isinstance(obj, complex):
... return [obj.real, obj.imag]
... raise TypeError(repr(o) + " is not JSON serializable")
...
>>> json.dumps(2 + 1j, default=encode_complex)
'[2.0, 1.0]'
>>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
'[2.0, 1.0]'
>>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
'[2.0, 1.0]'
Using simplejson.tool from the shell to validate and pretty-print::
$ echo '{"json":"obj"}' | python -m simplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
__version__ = '2.1.0'
__all__ = [
'dump', 'dumps', 'load', 'loads',
'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
'OrderedDict',
]
__author__ = 'Bob Ippolito <bob@redivi.com>'
from decoder import JSONDecoder, JSONDecodeError
from encoder import JSONEncoder
try:
from collections import OrderedDict
except ImportError:
from ordered_dict import OrderedDict
_default_encoder = JSONEncoder(
skipkeys=False,
ensure_ascii=True,
check_circular=True,
allow_nan=True,
indent=None,
separators=None,
encoding='utf-8',
default=None,
)
def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
"""Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
``.write()``-supporting file-like object).
If ``skipkeys`` is true then ``dict`` keys that are not basic types
(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
will be skipped instead of raising a ``TypeError``.
If ``ensure_ascii`` is false, then the some chunks written to ``fp``
may be ``unicode`` instances, subject to normal Python ``str`` to
``unicode`` coercion rules. Unless ``fp.write()`` explicitly
understands ``unicode`` (as in ``codecs.getwriter()``) this is likely
to cause an error.
If ``check_circular`` is false, then the circular reference check
for container types will be skipped and a circular reference will
result in an ``OverflowError`` (or worse).
If ``allow_nan`` is false, then it will be a ``ValueError`` to
serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
in strict compliance of the JSON specification, instead of using the
JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
If *indent* is a string, then JSON array elements and object members
will be pretty-printed with a newline followed by that string repeated
for each level of nesting. ``None`` (the default) selects the most compact
representation without any newlines. For backwards compatibility with
versions of simplejson earlier than 2.1.0, an integer is also accepted
and is converted to a string with that many spaces.
If ``separators`` is an ``(item_separator, dict_separator)`` tuple
then it will be used instead of the default ``(', ', ': ')`` separators.
``(',', ':')`` is the most compact JSON representation.
``encoding`` is the character encoding for str instances, default is UTF-8.
``default(obj)`` is a function that should return a serializable version
of obj or raise TypeError. The default simply raises TypeError.
To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
``.default()`` method to serialize additional types), specify it with
the ``cls`` kwarg.
"""
# cached encoder
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
encoding == 'utf-8' and default is None and not kw):
iterable = _default_encoder.iterencode(obj)
else:
if cls is None:
cls = JSONEncoder
iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
check_circular=check_circular, allow_nan=allow_nan, indent=indent,
separators=separators, encoding=encoding,
default=default, **kw).iterencode(obj)
# could accelerate with writelines in some versions of Python, at
# a debuggability cost
for chunk in iterable:
fp.write(chunk)
def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
"""Serialize ``obj`` to a JSON formatted ``str``.
If ``skipkeys`` is false then ``dict`` keys that are not basic types
(``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
will be skipped instead of raising a ``TypeError``.
If ``ensure_ascii`` is false, then the return value will be a
``unicode`` instance subject to normal Python ``str`` to ``unicode``
coercion rules instead of being escaped to an ASCII ``str``.
If ``check_circular`` is false, then the circular reference check
for container types will be skipped and a circular reference will
result in an ``OverflowError`` (or worse).
If ``allow_nan`` is false, then it will be a ``ValueError`` to
serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
strict compliance of the JSON specification, instead of using the
JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
If ``indent`` is a string, then JSON array elements and object members
will be pretty-printed with a newline followed by that string repeated
for each level of nesting. ``None`` (the default) selects the most compact
representation without any newlines. For backwards compatibility with
versions of simplejson earlier than 2.1.0, an integer is also accepted
and is converted to a string with that many spaces.
If ``separators`` is an ``(item_separator, dict_separator)`` tuple
then it will be used instead of the default ``(', ', ': ')`` separators.
``(',', ':')`` is the most compact JSON representation.
``encoding`` is the character encoding for str instances, default is UTF-8.
``default(obj)`` is a function that should return a serializable version
of obj or raise TypeError. The default simply raises TypeError.
To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
``.default()`` method to serialize additional types), specify it with
the ``cls`` kwarg.
"""
# cached encoder
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
encoding == 'utf-8' and default is None and not kw):
return _default_encoder.encode(obj)
if cls is None:
cls = JSONEncoder
return cls(
skipkeys=skipkeys, ensure_ascii=ensure_ascii,
check_circular=check_circular, allow_nan=allow_nan, indent=indent,
separators=separators, encoding=encoding, default=default,
**kw).encode(obj)
_default_decoder = JSONDecoder(encoding=None, object_hook=None,
object_pairs_hook=None)
def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
"""Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
a JSON document) to a Python object.
*encoding* determines the encoding used to interpret any
:class:`str` objects decoded by this instance (``'utf-8'`` by
default). It has no effect when decoding :class:`unicode` objects.
Note that currently only encodings that are a superset of ASCII work,
strings of other encodings should be passed in as :class:`unicode`.
*object_hook*, if specified, will be called with the result of every
JSON object decoded and its return value will be used in place of the
given :class:`dict`. This can be used to provide custom
deserializations (e.g. to support JSON-RPC class hinting).
*object_pairs_hook* is an optional function that will be called with
the result of any object literal decode with an ordered list of pairs.
The return value of *object_pairs_hook* will be used instead of the
:class:`dict`. This feature can be used to implement custom decoders
that rely on the order that the key and value pairs are decoded (for
example, :func:`collections.OrderedDict` will remember the order of
insertion). If *object_hook* is also defined, the *object_pairs_hook*
takes priority.
*parse_float*, if specified, will be called with the string of every
JSON float to be decoded. By default, this is equivalent to
``float(num_str)``. This can be used to use another datatype or parser
for JSON floats (e.g. :class:`decimal.Decimal`).
*parse_int*, if specified, will be called with the string of every
JSON int to be decoded. By default, this is equivalent to
``int(num_str)``. This can be used to use another datatype or parser
for JSON integers (e.g. :class:`float`).
*parse_constant*, if specified, will be called with one of the
following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
can be used to raise an exception if invalid JSON numbers are
encountered.
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg.
"""
return loads(fp.read(),
encoding=encoding, cls=cls, object_hook=object_hook,
parse_float=parse_float, parse_int=parse_int,
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
**kw)
def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the encoding used to interpret any
:class:`str` objects decoded by this instance (``'utf-8'`` by
default). It has no effect when decoding :class:`unicode` objects.
Note that currently only encodings that are a superset of ASCII work,
strings of other encodings should be passed in as :class:`unicode`.
*object_hook*, if specified, will be called with the result of every
JSON object decoded and its return value will be used in place of the
given :class:`dict`. This can be used to provide custom
deserializations (e.g. to support JSON-RPC class hinting).
*object_pairs_hook* is an optional function that will be called with
the result of any object literal decode with an ordered list of pairs.
The return value of *object_pairs_hook* will be used instead of the
:class:`dict`. This feature can be used to implement custom decoders
that rely on the order that the key and value pairs are decoded (for
example, :func:`collections.OrderedDict` will remember the order of
insertion). If *object_hook* is also defined, the *object_pairs_hook*
takes priority.
*parse_float*, if specified, will be called with the string of every
JSON float to be decoded. By default, this is equivalent to
``float(num_str)``. This can be used to use another datatype or parser
for JSON floats (e.g. :class:`decimal.Decimal`).
*parse_int*, if specified, will be called with the string of every
JSON int to be decoded. By default, this is equivalent to
``int(num_str)``. This can be used to use another datatype or parser
for JSON integers (e.g. :class:`float`).
*parse_constant*, if specified, will be called with one of the
following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This
can be used to raise an exception if invalid JSON numbers are
encountered.
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg.
"""
if (cls is None and encoding is None and object_hook is None and
parse_int is None and parse_float is None and
parse_constant is None and object_pairs_hook is None and not kw):
return _default_decoder.decode(s)
if cls is None:
cls = JSONDecoder
if object_hook is not None:
kw['object_hook'] = object_hook
if object_pairs_hook is not None:
kw['object_pairs_hook'] = object_pairs_hook
if parse_float is not None:
kw['parse_float'] = parse_float
if parse_int is not None:
kw['parse_int'] = parse_int
if parse_constant is not None:
kw['parse_constant'] = parse_constant
return cls(encoding=encoding, **kw).decode(s)
def _toggle_speedups(enabled):
import simplejson.decoder as dec
import simplejson.encoder as enc
import simplejson.scanner as scan
try:
from simplejson._speedups import make_encoder as c_make_encoder
except ImportError:
c_make_encoder = None
if enabled:
dec.scanstring = dec.c_scanstring or dec.py_scanstring
enc.c_make_encoder = c_make_encoder
enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or
enc.py_encode_basestring_ascii)
scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner
else:
dec.scanstring = dec.py_scanstring
enc.c_make_encoder = None
enc.encode_basestring_ascii = enc.py_encode_basestring_ascii
scan.make_scanner = scan.py_make_scanner
dec.make_scanner = scan.make_scanner
global _default_decoder
_default_decoder = JSONDecoder(
encoding=None,
object_hook=None,
object_pairs_hook=None,
)
global _default_encoder
_default_encoder = JSONEncoder(
skipkeys=False,
ensure_ascii=True,
check_circular=True,
allow_nan=True,
indent=None,
separators=None,
encoding='utf-8',
default=None,
) | ajibawa-2023/Python-Code-Large/train/row_1150 | 66 | 406 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 99], "level": 0, "parent": null, "vector": [8, 0, 0.1232, 0.2438, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "r\"\"\"JSON (JavaScript Object Notation) <http://json.org> is a subset of\nJavaScript syntax (ECMA-262 3rd edition) used as a lightweight data\ninterchange format.\n\n:mod:`simplejson` exposes an API familiar to users of the standard library\n:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained\nversion of the :mod:`json` library contained in Python 2.6, but maintains\ncompatibility with Python 2.4 and Python 2.5 and (currently) has"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L100_C0", "label": "__version__ =", "type": "assigned_variable", "loc": [100, 100], "level": 0, "parent": null, "vector": [14, 0, 0.2463, 0.0025, 0, 0.66, 0.0769, 162, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__version__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__version__ = '2.1.0'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L101_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [101, 105], "level": 0, "parent": null, "vector": [14, 0, 0.2537, 0.0123, 0, 0.66, 0.1538, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__all__ = [\n 'dump', 'dumps', 'load', 'loads',\n 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',\n 'OrderedDict',\n]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L107_C0", "label": "__author__ =", "type": "assigned_variable", "loc": [107, 107], "level": 0, "parent": null, "vector": [14, 0, 0.2635, 0.0025, 0, 0.66, 0.2308, 777, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "__author__", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "__author__ = 'Bob Ippolito <bob@redivi.com>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L109_C0", "label": "from decoder import JSONDecoder, JSONDecodeError", "type": "import", "loc": [109, 109], "level": 0, "parent": null, "vector": [1, 0, 0.2685, 0.0025, 0, 0.66, 0.3077, 404, 0, 2, 0, 0, 404, 0, 0], "semantic": {"name": "decoder", "arg_names": [], "import_names": ["JSONDecoder", "JSONDecodeError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from decoder import JSONDecoder, JSONDecodeError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L110_C0", "label": "from encoder import JSONEncoder", "type": "import", "loc": [110, 110], "level": 0, "parent": null, "vector": [1, 0, 0.2709, 0.0025, 0, 0.66, 0.3846, 672, 0, 1, 0, 0, 672, 0, 0], "semantic": {"name": "encoder", "arg_names": [], "import_names": ["JSONEncoder"], "rhs_call_name": "", "annotation": ""}, "snippet": "from encoder import JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L111_C0", "label": "try", "type": "try", "loc": [111, 114], "level": 0, "parent": null, "vector": [7, 0, 0.2771, 0.0099, 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 from collections import OrderedDict\nexcept ImportError:\n from ordered_dict import OrderedDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L112_C4", "label": "from collections import OrderedDict", "type": "import", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L111_C0", "vector": [1, 1, 0.2759, 0.0025, 1, 0.51, 0.0, 193, 0, 1, 0, 0, 193, 0, 0], "semantic": {"name": "collections", "arg_names": [], "import_names": ["OrderedDict"], "rhs_call_name": "", "annotation": ""}, "snippet": " from collections import OrderedDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L114_C4", "label": "from ordered_dict import OrderedDict", "type": "import", "loc": [114, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L111_C0", "vector": [1, 1, 0.2808, 0.0025, 1, 0.51, 0.0, 444, 0, 1, 0, 0, 444, 0, 0], "semantic": {"name": "ordered_dict", "arg_names": [], "import_names": ["OrderedDict"], "rhs_call_name": "", "annotation": ""}, "snippet": " from ordered_dict import OrderedDict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L116_C0", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [116, 125], "level": 0, "parent": null, "vector": [14, 0, 0.2968, 0.0246, 0, 0.66, 0.5385, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": "_default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "label": "dump", "type": "function", "loc": [127, 189], "level": 0, "parent": null, "vector": [2, 0, 0.3892, 0.1552, 0, 0.66, 0.6154, 952, 0, 12, 0, 0, 0, 0, 4], "semantic": {"name": "dump", "arg_names": ["obj", "fp", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is true then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L130_C4", "label": "expression", "type": "expression", "loc": [130, 172], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "vector": [8, 1, 0.3719, 0.1059, 1, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` as a JSON formatted stream to ``fp`` (a\n ``.write()``-supporting file-like object).\n\n If ``skipkeys`` is true then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is false, then the some chunks written to ``fp``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "label": "if", "type": "if", "loc": [174, 185], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "vector": [4, 1, 0.4421, 0.0296, 1, 0.21, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not skipkeys and ensure_ascii and\n check_circular and allow_nan and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n iterable = _default_encoder.iterencode(obj)\n else:\n if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L178_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [178, 178], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "vector": [14, 2, 0.4384, 0.0025, 2, 0.62, 0.0, 444, 3, 1, 0, 0, 315, 10, 1], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = _default_encoder.iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L180_C8", "label": "if", "type": "if", "loc": [180, 181], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "vector": [4, 2, 0.4446, 0.0049, 2, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L181_C12", "label": "cls =", "type": "assigned_variable", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L180_C8", "vector": [14, 3, 0.4458, 0.0025, 3, 0.64, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L182_C8", "label": "iterable = iterencode()", "type": "assigned_variable", "loc": [182, 185], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "vector": [14, 2, 0.452, 0.0099, 2, 0.62, 1.0, 444, 3, 1, 0, 0, 315, 10, 2], "semantic": {"name": "iterable", "arg_names": [], "import_names": [], "rhs_call_name": "iterencode", "annotation": ""}, "snippet": " iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding,\n default=default, **kw).iterencode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:For_L188_C4", "label": "for chunk", "type": "for", "loc": [188, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "vector": [6, 1, 0.4643, 0.0049, 1, 0.21, 1.0, 637, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for chunk in iterable:\n fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L189_C8", "label": "write()", "type": "expression", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:For_L188_C4", "vector": [8, 2, 0.4655, 0.0025, 2, 0.3, 0.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " fp.write(chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "label": "dumps", "type": "function", "loc": [192, 247], "level": 0, "parent": null, "vector": [2, 0, 0.5406, 0.1379, 0, 0.66, 0.6923, 160, 0, 11, 1, 0, 0, 0, 3], "semantic": {"name": "dumps", "arg_names": ["obj", "skipkeys", "ensure_ascii", "check_circular", "allow_nan", "cls", "indent", "separators", "encoding", "default", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,\n allow_nan=True, cls=None, indent=None, separators=None,\n encoding='utf-8', default=None, **kw):\n \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is false then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L195_C4", "label": "expression", "type": "expression", "loc": [195, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "vector": [8, 1, 0.5283, 0.0985, 1, 0.69, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Serialize ``obj`` to a JSON formatted ``str``.\n\n If ``skipkeys`` is false then ``dict`` keys that are not basic types\n (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)\n will be skipped instead of raising a ``TypeError``.\n\n If ``ensure_ascii`` is false, then the return value will be a\n ``unicode`` instance subject to normal Python ``str`` to ``unicode``"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L236_C4", "label": "if", "type": "if", "loc": [236, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "vector": [4, 1, 0.5862, 0.0123, 1, 0.69, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (not skipkeys and ensure_ascii and\n check_circular and allow_nan and\n cls is None and indent is None and separators is None and\n encoding == 'utf-8' and default is None and not kw):\n return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L240_C8", "label": "return", "type": "return", "loc": [240, 240], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L236_C4", "vector": [13, 2, 0.5911, 0.0025, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_encoder.encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L241_C4", "label": "if", "type": "if", "loc": [241, 242], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "vector": [4, 1, 0.5948, 0.0049, 1, 0.69, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L242_C8", "label": "cls =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L241_C4", "vector": [14, 2, 0.5961, 0.0025, 2, 0.63, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONEncoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L243_C4", "label": "return", "type": "return", "loc": [243, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "vector": [13, 1, 0.6034, 0.0123, 1, 0.69, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(\n skipkeys=skipkeys, ensure_ascii=ensure_ascii,\n check_circular=check_circular, allow_nan=allow_nan, indent=indent,\n separators=separators, encoding=encoding, default=default,\n **kw).encode(obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L250_C0", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [250, 251], "level": 0, "parent": null, "vector": [14, 0, 0.617, 0.0049, 0, 0.66, 0.7692, 340, 3, 3, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": "_default_decoder = JSONDecoder(encoding=None, object_hook=None,\n object_pairs_hook=None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L254_C0", "label": "load", "type": "function", "loc": [254, 303], "level": 0, "parent": null, "vector": [2, 0, 0.686, 0.1232, 0, 0.66, 0.8462, 37, 0, 9, 1, 0, 0, 0, 2], "semantic": {"name": "load", "arg_names": ["fp", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "object_pairs_hook", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\n \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n *encoding* determines the encoding used to interpret any\n :class:`str` objects decoded by this instance (``'utf-8'`` by\n default). It has no effect when decoding :class:`unicode` objects."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L256_C4", "label": "expression", "type": "expression", "loc": [256, 298], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L254_C0", "vector": [8, 1, 0.6823, 0.1059, 1, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``fp`` (a ``.read()``-supporting file-like object containing\n a JSON document) to a Python object.\n\n *encoding* determines the encoding used to interpret any\n :class:`str` objects decoded by this instance (``'utf-8'`` by\n default). It has no effect when decoding :class:`unicode` objects.\n\n Note that currently only encodings that are a superset of ASCII work,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L299_C4", "label": "return", "type": "return", "loc": [299, 303], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L254_C0", "vector": [13, 1, 0.7414, 0.0123, 1, 0.95, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return loads(fp.read(),\n encoding=encoding, cls=cls, object_hook=object_hook,\n parse_float=parse_float, parse_int=parse_int,\n parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,\n **kw)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "label": "loads", "type": "function", "loc": [306, 367], "level": 0, "parent": null, "vector": [2, 0, 0.8288, 0.1527, 0, 0.66, 0.9231, 88, 0, 9, 1, 0, 0, 0, 3], "semantic": {"name": "loads", "arg_names": ["s", "encoding", "cls", "object_hook", "parse_float", "parse_int", "parse_constant", "object_pairs_hook", "kw"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,\n parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):\n \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n *encoding* determines the encoding used to interpret any\n :class:`str` objects decoded by this instance (``'utf-8'`` by\n default). It has no effect when decoding :class:`unicode` objects."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L308_C4", "label": "expression", "type": "expression", "loc": [308, 350], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [8, 1, 0.8103, 0.1059, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON\n document) to a Python object.\n\n *encoding* determines the encoding used to interpret any\n :class:`str` objects decoded by this instance (``'utf-8'`` by\n default). It has no effect when decoding :class:`unicode` objects.\n\n Note that currently only encodings that are a superset of ASCII work,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L351_C4", "label": "if", "type": "if", "loc": [351, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8682, 0.0099, 1, 0.65, 0.125, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (cls is None and encoding is None and object_hook is None and\n parse_int is None and parse_float is None and\n parse_constant is None and object_pairs_hook is None and not kw):\n return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L354_C8", "label": "return", "type": "return", "loc": [354, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L351_C4", "vector": [13, 2, 0.8719, 0.0025, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _default_decoder.decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L355_C4", "label": "if", "type": "if", "loc": [355, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8756, 0.0049, 1, 0.65, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cls is None:\n cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L356_C8", "label": "cls =", "type": "assigned_variable", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L355_C4", "vector": [14, 2, 0.8768, 0.0025, 2, 0.37, 0.0, 594, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls = JSONDecoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L357_C4", "label": "if", "type": "if", "loc": [357, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8805, 0.0049, 1, 0.65, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_hook is not None:\n kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L358_C8", "label": "assign", "type": "assigned_variable", "loc": [358, 358], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L357_C4", "vector": [14, 2, 0.8818, 0.0025, 2, 0.98, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_hook'] = object_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L359_C4", "label": "if", "type": "if", "loc": [359, 360], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8855, 0.0049, 1, 0.65, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if object_pairs_hook is not None:\n kw['object_pairs_hook'] = object_pairs_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L360_C8", "label": "assign", "type": "assigned_variable", "loc": [360, 360], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L359_C4", "vector": [14, 2, 0.8867, 0.0025, 2, 0.47, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['object_pairs_hook'] = object_pairs_hook"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L361_C4", "label": "if", "type": "if", "loc": [361, 362], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8904, 0.0049, 1, 0.65, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_float is not None:\n kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L362_C8", "label": "assign", "type": "assigned_variable", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L361_C4", "vector": [14, 2, 0.8916, 0.0025, 2, 0.93, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_float'] = parse_float"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L363_C4", "label": "if", "type": "if", "loc": [363, 364], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.8953, 0.0049, 1, 0.65, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_int is not None:\n kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L364_C8", "label": "assign", "type": "assigned_variable", "loc": [364, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L363_C4", "vector": [14, 2, 0.8966, 0.0025, 2, 0.07, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_int'] = parse_int"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L365_C4", "label": "if", "type": "if", "loc": [365, 366], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [4, 1, 0.9002, 0.0049, 1, 0.65, 0.875, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parse_constant is not None:\n kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L366_C8", "label": "assign", "type": "assigned_variable", "loc": [366, 366], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L365_C4", "vector": [14, 2, 0.9015, 0.0025, 2, 0.71, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " kw['parse_constant'] = parse_constant"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L367_C4", "label": "return", "type": "return", "loc": [367, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "vector": [13, 1, 0.9039, 0.0025, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return cls(encoding=encoding, **kw).decode(s)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "label": "_toggle_speedups", "type": "function", "loc": [370, 406], "level": 0, "parent": null, "vector": [2, 0, 0.9557, 0.0911, 0, 0.66, 1.0, 614, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "_toggle_speedups", "arg_names": ["enabled"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _toggle_speedups(enabled):\n import simplejson.decoder as dec\n import simplejson.encoder as enc\n import simplejson.scanner as scan\n try:\n from simplejson._speedups import make_encoder as c_make_encoder\n except ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L371_C4", "label": "simplejson.decoder import dec", "type": "import", "loc": [371, 371], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [1, 1, 0.9138, 0.0025, 1, 0.38, 0.0, 826, 0, 1, 0, 0, 826, 0, 0], "semantic": {"name": "simplejson.decoder", "arg_names": [], "import_names": ["dec"], "rhs_call_name": "", "annotation": ""}, "snippet": " import simplejson.decoder as dec"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L372_C4", "label": "simplejson.encoder import enc", "type": "import", "loc": [372, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [1, 1, 0.9163, 0.0025, 1, 0.38, 0.1429, 293, 0, 1, 0, 0, 293, 0, 0], "semantic": {"name": "simplejson.encoder", "arg_names": [], "import_names": ["enc"], "rhs_call_name": "", "annotation": ""}, "snippet": " import simplejson.encoder as enc"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L373_C4", "label": "simplejson.scanner import scan", "type": "import", "loc": [373, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [1, 1, 0.9187, 0.0025, 1, 0.38, 0.2857, 15, 0, 1, 0, 0, 15, 0, 0], "semantic": {"name": "simplejson.scanner", "arg_names": [], "import_names": ["scan"], "rhs_call_name": "", "annotation": ""}, "snippet": " import simplejson.scanner as scan"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4", "label": "try", "type": "try", "loc": [374, 377], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [7, 1, 0.9249, 0.0099, 1, 0.38, 0.4286, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n from simplejson._speedups import make_encoder as c_make_encoder\n except ImportError:\n c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L375_C8", "label": "from simplejson._speedups import c_make_encoder", "type": "import", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4", "vector": [1, 2, 0.9236, 0.0025, 2, 0.4, 0.0, 976, 0, 1, 0, 0, 976, 0, 0], "semantic": {"name": "simplejson._speedups", "arg_names": [], "import_names": ["c_make_encoder"], "rhs_call_name": "", "annotation": ""}, "snippet": " from simplejson._speedups import make_encoder as c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L377_C8", "label": "c_make_encoder =", "type": "assigned_variable", "loc": [377, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4", "vector": [14, 2, 0.9286, 0.0025, 2, 0.4, 0.0, 30, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "label": "if", "type": "if", "loc": [378, 388], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [4, 1, 0.9433, 0.0271, 1, 0.38, 0.5714, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if enabled:\n dec.scanstring = dec.c_scanstring or dec.py_scanstring\n enc.c_make_encoder = c_make_encoder\n enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or \n enc.py_encode_basestring_ascii)\n scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner\n else:\n dec.scanstring = dec.py_scanstring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L379_C8", "label": "dec.scanstring =", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9335, 0.0025, 2, 0.6, 0.0, 202, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dec.scanstring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dec.scanstring = dec.c_scanstring or dec.py_scanstring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L380_C8", "label": "enc.c_make_encoder =", "type": "assigned_variable", "loc": [380, 380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.936, 0.0025, 2, 0.6, 0.1429, 515, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enc.c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enc.c_make_encoder = c_make_encoder"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L381_C8", "label": "enc.encode_basestring_ascii =", "type": "assigned_variable", "loc": [381, 382], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9397, 0.0049, 2, 0.6, 0.2857, 513, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enc.encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enc.encode_basestring_ascii = (enc.c_encode_basestring_ascii or \n enc.py_encode_basestring_ascii)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L383_C8", "label": "scan.make_scanner =", "type": "assigned_variable", "loc": [383, 383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9433, 0.0025, 2, 0.6, 0.4286, 273, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scan.make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scan.make_scanner = scan.c_make_scanner or scan.py_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L385_C8", "label": "dec.scanstring =", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9483, 0.0025, 2, 0.6, 0.5714, 202, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dec.scanstring", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dec.scanstring = dec.py_scanstring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L386_C8", "label": "enc.c_make_encoder =", "type": "assigned_variable", "loc": [386, 386], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9507, 0.0025, 2, 0.6, 0.7143, 515, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "enc.c_make_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enc.c_make_encoder = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L387_C8", "label": "enc.encode_basestring_ascii =", "type": "assigned_variable", "loc": [387, 387], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9532, 0.0025, 2, 0.6, 0.8571, 513, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "enc.encode_basestring_ascii", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " enc.encode_basestring_ascii = enc.py_encode_basestring_ascii"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L388_C8", "label": "scan.make_scanner =", "type": "assigned_variable", "loc": [388, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "vector": [14, 2, 0.9557, 0.0025, 2, 0.6, 1.0, 273, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "scan.make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " scan.make_scanner = scan.py_make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L389_C4", "label": "dec.make_scanner =", "type": "assigned_variable", "loc": [389, 389], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [14, 1, 0.9581, 0.0025, 1, 0.38, 0.7143, 42, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dec.make_scanner", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dec.make_scanner = scan.make_scanner"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L391_C4", "label": "_default_decoder = JSONDecoder()", "type": "assigned_variable", "loc": [391, 395], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [14, 1, 0.968, 0.0123, 1, 0.38, 0.8571, 340, 3, 3, 0, 0, 611, 10, 1], "semantic": {"name": "_default_decoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONDecoder", "annotation": ""}, "snippet": " _default_decoder = JSONDecoder(\n encoding=None,\n object_hook=None,\n object_pairs_hook=None,\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L397_C4", "label": "_default_encoder = JSONEncoder()", "type": "assigned_variable", "loc": [397, 406], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "vector": [14, 1, 0.9889, 0.0246, 1, 0.38, 1.0, 619, 3, 8, 0, 0, 228, 10, 1], "semantic": {"name": "_default_encoder", "arg_names": [], "import_names": [], "rhs_call_name": "JSONEncoder", "annotation": ""}, "snippet": " _default_encoder = JSONEncoder(\n skipkeys=False,\n ensure_ascii=True,\n check_circular=True,\n allow_nan=True,\n indent=None,\n separators=None,\n encoding='utf-8',"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L111_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L182_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L127_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:For_L188_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:For_L188_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L189_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L195_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L241_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L192_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L256_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L254_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L299_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Expr_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L354_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L355_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L357_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L357_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L358_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L361_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L363_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L364_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L365_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L365_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L366_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L306_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Return_L367_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Import_L373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:ImportFrom_L375_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:Try_L374_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L381_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L383_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L387_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:If_L378_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L388_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L389_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L391_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1150:FunctionDef_L370_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1150:Assign_L397_C4"}] |
import cgi
import urllib
import time
import random
import urlparse
import hmac
import base64
VERSION = '1.0' # Hi Blaine!
HTTP_METHOD = 'GET'
SIGNATURE_METHOD = 'PLAINTEXT'
# Generic exception class
class OAuthError(RuntimeError):
def __init__(self, message='OAuth error occured.'):
self.message = message
# optional WWW-Authenticate header (401 error)
def build_authenticate_header(realm=''):
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
# url escape
def escape(s):
# escape '/' too
return urllib.quote(s, safe='~')
# util function: current timestamp
# seconds since epoch (UTC)
def generate_timestamp():
return int(time.time())
# util function: nonce
# pseudorandom number
def generate_nonce(length=8):
return ''.join(str(random.randint(0, 9)) for i in range(length))
# OAuthConsumer is a data type that represents the identity of the Consumer
# via its shared secret with the Service Provider.
class OAuthConsumer(object):
key = None
secret = None
def __init__(self, key, secret):
self.key = key
self.secret = secret
# OAuthToken is a data type that represents an End User via either an access
# or request token.
class OAuthToken(object):
# access tokens and request tokens
key = None
secret = None
'''
key = the token
secret = the token secret
'''
def __init__(self, key, secret):
self.key = key
self.secret = secret
def to_string(self):
return urllib.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret})
# return a token from something like:
# oauth_token_secret=digg&oauth_token=digg
@staticmethod
def from_string(s):
params = cgi.parse_qs(s, keep_blank_values=False)
key = params['oauth_token'][0]
secret = params['oauth_token_secret'][0]
return OAuthToken(key, secret)
def __str__(self):
return self.to_string()
# OAuthRequest represents the request and can be serialized
class OAuthRequest(object):
'''
OAuth parameters:
- oauth_consumer_key
- oauth_token
- oauth_signature_method
- oauth_signature
- oauth_timestamp
- oauth_nonce
- oauth_version
... any additional parameters, as defined by the Service Provider.
'''
parameters = None # oauth parameters
http_method = HTTP_METHOD
http_url = None
version = VERSION
def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None):
self.http_method = http_method
self.http_url = http_url
self.parameters = parameters or {}
def set_parameter(self, parameter, value):
self.parameters[parameter] = value
def get_parameter(self, parameter):
try:
return self.parameters[parameter]
except:
raise OAuthError('Parameter not found: %s' % parameter)
def _get_timestamp_nonce(self):
return self.get_parameter('oauth_timestamp'), self.get_parameter('oauth_nonce')
# get any non-oauth parameters
def get_nonoauth_parameters(self):
parameters = {}
for k, v in self.parameters.iteritems():
# ignore oauth parameters
if k.find('oauth_') < 0:
parameters[k] = v
return parameters
# serialize as a header for an HTTPAuth request
def to_header(self, realm=''):
auth_header = 'OAuth realm="%s"' % realm
# add the oauth parameters
if self.parameters:
for k, v in self.parameters.iteritems():
auth_header += ', %s="%s"' % (k, escape(str(v)))
return {'Authorization': auth_header}
# serialize as post data for a POST request
def to_postdata(self):
return '&'.join('%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.iteritems())
# serialize as a url for a GET request
def to_url(self):
return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())
# return a string that consists of all the parameters that need to be signed
def get_normalized_parameters(self):
params = self.parameters
try:
# exclude the signature if it exists
del params['oauth_signature']
except:
pass
key_values = params.items()
# sort lexicographically, first after key, then after value
key_values.sort()
# combine key value pairs in string and escape
return '&'.join('%s=%s' % (escape(str(k)), escape(str(v))) for k, v in key_values)
# just uppercases the http method
def get_normalized_http_method(self):
return self.http_method.upper()
# parses the url and rebuilds it to be scheme://host/path
def get_normalized_http_url(self):
parts = urlparse.urlparse(self.http_url)
url_string = '%s://%s%s' % (parts[0], parts[1], parts[2]) # scheme, netloc, path
return url_string
# set the signature parameter to the result of build_signature
def sign_request(self, signature_method, consumer, token):
# set the signature method
self.set_parameter('oauth_signature_method', signature_method.get_name())
# set the signature
self.set_parameter('oauth_signature', self.build_signature(signature_method, consumer, token))
def build_signature(self, signature_method, consumer, token):
# call the build signature method within the signature method
return signature_method.build_signature(self, consumer, token)
@staticmethod
def from_request(http_method, http_url, headers=None, parameters=None, query_string=None):
# combine multiple parameter sources
if parameters is None:
parameters = {}
# headers
if headers and 'Authorization' in headers:
auth_header = headers['Authorization']
# check that the authorization header is OAuth
if auth_header.index('OAuth') > -1:
try:
# get the parameters from the header
header_params = OAuthRequest._split_header(auth_header)
parameters.update(header_params)
except:
raise OAuthError('Unable to parse OAuth parameters from Authorization header.')
# GET or POST query string
if query_string:
query_params = OAuthRequest._split_url_string(query_string)
parameters.update(query_params)
# URL parameters
param_str = urlparse.urlparse(http_url)[4] # query
url_params = OAuthRequest._split_url_string(param_str)
parameters.update(url_params)
if parameters:
return OAuthRequest(http_method, http_url, parameters)
return None
@staticmethod
def from_consumer_and_token(oauth_consumer, token=None, http_method=HTTP_METHOD, http_url=None, parameters=None):
if not parameters:
parameters = {}
defaults = {
'oauth_consumer_key': oauth_consumer.key,
'oauth_timestamp': generate_timestamp(),
'oauth_nonce': generate_nonce(),
'oauth_version': OAuthRequest.version,
}
defaults.update(parameters)
parameters = defaults
if token:
parameters['oauth_token'] = token.key
return OAuthRequest(http_method, http_url, parameters)
@staticmethod
def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD, http_url=None, parameters=None):
if not parameters:
parameters = {}
parameters['oauth_token'] = token.key
if callback:
parameters['oauth_callback'] = escape(callback)
return OAuthRequest(http_method, http_url, parameters)
# util function: turn Authorization: header into parameters, has to do some unescaping
@staticmethod
def _split_header(header):
params = {}
parts = header.split(',')
for param in parts:
# ignore realm parameter
if param.find('OAuth realm') > -1:
continue
# remove whitespace
param = param.strip()
# split key-value
param_parts = param.split('=', 1)
# remove quotes and unescape the value
params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\"'))
return params
# util function: turn url string into parameters, has to do some unescaping
@staticmethod
def _split_url_string(param_str):
parameters = cgi.parse_qs(param_str, keep_blank_values=False)
for k, v in parameters.iteritems():
parameters[k] = urllib.unquote(v[0])
return parameters
# OAuthServer is a worker to check a requests validity against a data store
class OAuthServer(object):
timestamp_threshold = 300 # in seconds, five minutes
version = VERSION
signature_methods = None
data_store = None
def __init__(self, data_store=None, signature_methods=None):
self.data_store = data_store
self.signature_methods = signature_methods or {}
def set_data_store(self, oauth_data_store):
self.data_store = data_store
def get_data_store(self):
return self.data_store
def add_signature_method(self, signature_method):
self.signature_methods[signature_method.get_name()] = signature_method
return self.signature_methods
# process a request_token request
# returns the request token on success
def fetch_request_token(self, oauth_request):
try:
# get the request token for authorization
token = self._get_token(oauth_request, 'request')
except OAuthError:
# no token required for the initial token request
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
self._check_signature(oauth_request, consumer, None)
# fetch a new token
token = self.data_store.fetch_request_token(consumer)
return token
# process an access_token request
# returns the access token on success
def fetch_access_token(self, oauth_request):
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
# get the request token
token = self._get_token(oauth_request, 'request')
self._check_signature(oauth_request, consumer, token)
new_token = self.data_store.fetch_access_token(consumer, token)
return new_token
# verify an api call, checks all the parameters
def verify_request(self, oauth_request):
# -> consumer and token
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
# get the access token
token = self._get_token(oauth_request, 'access')
self._check_signature(oauth_request, consumer, token)
parameters = oauth_request.get_nonoauth_parameters()
return consumer, token, parameters
# authorize a request token
def authorize_token(self, token, user):
return self.data_store.authorize_request_token(token, user)
# get the callback url
def get_callback(self, oauth_request):
return oauth_request.get_parameter('oauth_callback')
# optional support for the authenticate header
def build_authenticate_header(self, realm=''):
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm}
# verify the correct version request for this server
def _get_version(self, oauth_request):
try:
version = oauth_request.get_parameter('oauth_version')
except:
version = VERSION
if version and version != self.version:
raise OAuthError('OAuth version %s not supported.' % str(version))
return version
# figure out the signature with some defaults
def _get_signature_method(self, oauth_request):
try:
signature_method = oauth_request.get_parameter('oauth_signature_method')
except:
signature_method = SIGNATURE_METHOD
try:
# get the signature method object
signature_method = self.signature_methods[signature_method]
except:
signature_method_names = ', '.join(self.signature_methods.keys())
raise OAuthError('Signature method %s not supported try one of the following: %s' % (signature_method, signature_method_names))
return signature_method
def _get_consumer(self, oauth_request):
consumer_key = oauth_request.get_parameter('oauth_consumer_key')
if not consumer_key:
raise OAuthError('Invalid consumer key.')
consumer = self.data_store.lookup_consumer(consumer_key)
if not consumer:
raise OAuthError('Invalid consumer.')
return consumer
# try to find the token for the provided request token key
def _get_token(self, oauth_request, token_type='access'):
token_field = oauth_request.get_parameter('oauth_token')
token = self.data_store.lookup_token(token_type, token_field)
if not token:
raise OAuthError('Invalid %s token: %s' % (token_type, token_field))
return token
def _check_signature(self, oauth_request, consumer, token):
timestamp, nonce = oauth_request._get_timestamp_nonce()
self._check_timestamp(timestamp)
self._check_nonce(consumer, token, nonce)
signature_method = self._get_signature_method(oauth_request)
try:
signature = oauth_request.get_parameter('oauth_signature')
except:
raise OAuthError('Missing signature.')
# validate the signature
valid_sig = signature_method.check_signature(oauth_request, consumer, token, signature)
if not valid_sig:
key, base = signature_method.build_signature_base_string(oauth_request, consumer, token)
raise OAuthError('Invalid signature. Expected signature base string: %s' % base)
built = signature_method.build_signature(oauth_request, consumer, token)
def _check_timestamp(self, timestamp):
# verify that timestamp is recentish
timestamp = int(timestamp)
now = int(time.time())
lapsed = now - timestamp
if lapsed > self.timestamp_threshold:
raise OAuthError('Expired timestamp: given %d and now %s has a greater difference than threshold %d' % (timestamp, now, self.timestamp_threshold))
def _check_nonce(self, consumer, token, nonce):
# verify that the nonce is uniqueish
nonce = self.data_store.lookup_nonce(consumer, token, nonce)
if nonce:
raise OAuthError('Nonce already used: %s' % str(nonce))
# OAuthClient is a worker to attempt to execute a request
class OAuthClient(object):
consumer = None
token = None
def __init__(self, oauth_consumer, oauth_token):
self.consumer = oauth_consumer
self.token = oauth_token
def get_consumer(self):
return self.consumer
def get_token(self):
return self.token
def fetch_request_token(self, oauth_request):
# -> OAuthToken
raise NotImplementedError
def fetch_access_token(self, oauth_request):
# -> OAuthToken
raise NotImplementedError
def access_resource(self, oauth_request):
# -> some protected resource
raise NotImplementedError
# OAuthDataStore is a database abstraction used to lookup consumers and tokens
class OAuthDataStore(object):
def lookup_consumer(self, key):
# -> OAuthConsumer
raise NotImplementedError
def lookup_token(self, oauth_consumer, token_type, token_token):
# -> OAuthToken
raise NotImplementedError
def lookup_nonce(self, oauth_consumer, oauth_token, nonce, timestamp):
# -> OAuthToken
raise NotImplementedError
def fetch_request_token(self, oauth_consumer):
# -> OAuthToken
raise NotImplementedError
def fetch_access_token(self, oauth_consumer, oauth_token):
# -> OAuthToken
raise NotImplementedError
def authorize_request_token(self, oauth_token, user):
# -> OAuthToken
raise NotImplementedError
# OAuthSignatureMethod is a strategy class that implements a signature method
class OAuthSignatureMethod(object):
def get_name(self):
# -> str
raise NotImplementedError
def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):
# -> str key, str raw
raise NotImplementedError
def build_signature(self, oauth_request, oauth_consumer, oauth_token):
# -> str
raise NotImplementedError
def check_signature(self, oauth_request, consumer, token, signature):
built = self.build_signature(oauth_request, consumer, token)
return built == signature
class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod):
def get_name(self):
return 'HMAC-SHA1'
def build_signature_base_string(self, oauth_request, consumer, token):
sig = (
escape(oauth_request.get_normalized_http_method()),
escape(oauth_request.get_normalized_http_url()),
escape(oauth_request.get_normalized_parameters()),
)
key = '%s&' % escape(consumer.secret)
if token:
key += escape(token.secret)
raw = '&'.join(sig)
return key, raw
def build_signature(self, oauth_request, consumer, token):
# build the base signature string
key, raw = self.build_signature_base_string(oauth_request, consumer, token)
# hmac object
try:
import hashlib # 2.5
hashed = hmac.new(key, raw, hashlib.sha1)
except:
import sha # deprecated
hashed = hmac.new(key, raw, sha)
# calculate the digest base 64
return base64.b64encode(hashed.digest())
class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod):
def get_name(self):
return 'PLAINTEXT'
def build_signature_base_string(self, oauth_request, consumer, token):
# concatenate the consumer key and secret
sig = escape(consumer.secret) + '&'
if token:
sig = sig + escape(token.secret)
return sig
def build_signature(self, oauth_request, consumer, token):
return self.build_signature_base_string(oauth_request, consumer, token)
| ajibawa-2023/Python-Code-Large/train/row_1152 | 281 | 523 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L1_C0", "label": "cgi import cgi", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0019, 0.0019, 0, 0.66, 0.0, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L2_C0", "label": "urllib import urllib", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0038, 0.0019, 0, 0.66, 0.0435, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L3_C0", "label": "time import time", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0019, 0, 0.66, 0.087, 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_1152:Import_L4_C0", "label": "random import random", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0076, 0.0019, 0, 0.66, 0.1304, 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_1152:Import_L5_C0", "label": "urlparse import urlparse", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0096, 0.0019, 0, 0.66, 0.1739, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L6_C0", "label": "hmac import hmac", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.0115, 0.0019, 0, 0.66, 0.2174, 993, 0, 1, 0, 0, 993, 0, 0], "semantic": {"name": "hmac", "arg_names": [], "import_names": ["hmac"], "rhs_call_name": "", "annotation": ""}, "snippet": "import hmac"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L7_C0", "label": "base64 import base64", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0134, 0.0019, 0, 0.66, 0.2609, 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_1152:Assign_L9_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [9, 9], "level": 0, "parent": null, "vector": [14, 0, 0.0172, 0.0019, 0, 0.66, 0.3043, 557, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION = '1.0' # Hi Blaine!"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L10_C0", "label": "HTTP_METHOD =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.0191, 0.0019, 0, 0.66, 0.3478, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "HTTP_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "HTTP_METHOD = 'GET'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L11_C0", "label": "SIGNATURE_METHOD =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.021, 0.0019, 0, 0.66, 0.3913, 339, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIGNATURE_METHOD", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SIGNATURE_METHOD = 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L14_C0", "label": "OAuthError", "type": "class", "loc": [14, 16], "level": 0, "parent": null, "vector": [3, 0, 0.0287, 0.0057, 0, 0.66, 0.4348, 899, 0, 1, 0, 0, 178, 0, 0], "semantic": {"name": "OAuthError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthError(RuntimeError):\n def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L15_C4", "label": "__init__", "type": "function", "loc": [15, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L14_C0", "vector": [2, 1, 0.0296, 0.0038, 1, 0.24, 0.0, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "message"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, message='OAuth error occured.'):\n self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L16_C8", "label": "self.message =", "type": "assigned_variable", "loc": [16, 16], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L15_C4", "vector": [14, 2, 0.0306, 0.0019, 2, 0.65, 0.0, 709, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = message"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L19_C0", "label": "build_authenticate_header", "type": "function", "loc": [19, 20], "level": 0, "parent": null, "vector": [2, 0, 0.0373, 0.0038, 0, 0.66, 0.4783, 279, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def build_authenticate_header(realm=''):\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L20_C4", "label": "return", "type": "return", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L19_C0", "vector": [13, 1, 0.0382, 0.0019, 1, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L23_C0", "label": "escape", "type": "function", "loc": [23, 25], "level": 0, "parent": null, "vector": [2, 0, 0.0459, 0.0057, 0, 0.66, 0.5217, 494, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "escape", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def escape(s):\n # escape '/' too\n return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L25_C4", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L23_C0", "vector": [13, 1, 0.0478, 0.0019, 1, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urllib.quote(s, safe='~')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L29_C0", "label": "generate_timestamp", "type": "function", "loc": [29, 30], "level": 0, "parent": null, "vector": [2, 0, 0.0564, 0.0038, 0, 0.66, 0.5652, 54, 0, 0, 1, 0, 0, 0, 2], "semantic": {"name": "generate_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_timestamp():\n return int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L30_C4", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L29_C0", "vector": [13, 1, 0.0574, 0.0019, 1, 0.08, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L34_C0", "label": "generate_nonce", "type": "function", "loc": [34, 35], "level": 0, "parent": null, "vector": [2, 0, 0.066, 0.0038, 0, 0.66, 0.6087, 53, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "generate_nonce", "arg_names": ["length"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def generate_nonce(length=8):\n return ''.join(str(random.randint(0, 9)) for i in range(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L34_C0", "vector": [13, 1, 0.0669, 0.0019, 1, 0.68, 0.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(str(random.randint(0, 9)) for i in range(length))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "label": "OAuthConsumer", "type": "class", "loc": [39, 45], "level": 0, "parent": null, "vector": [3, 0, 0.0803, 0.0134, 0, 0.66, 0.6522, 660, 0, 1, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthConsumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthConsumer(object):\n key = None\n secret = None\n\n def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L40_C4", "label": "key =", "type": "assigned_variable", "loc": [40, 40], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "vector": [14, 1, 0.0765, 0.0019, 1, 0.92, 0.0, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L41_C4", "label": "secret =", "type": "assigned_variable", "loc": [41, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "vector": [14, 1, 0.0784, 0.0019, 1, 0.92, 0.5, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4", "label": "__init__", "type": "function", "loc": [43, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "vector": [2, 1, 0.0841, 0.0057, 1, 0.92, 1.0, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L44_C8", "label": "self.key =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4", "vector": [14, 2, 0.0841, 0.0019, 2, 0.0, 0.0, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L45_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4", "vector": [14, 2, 0.086, 0.0019, 2, 0.0, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "label": "OAuthToken", "type": "class", "loc": [49, 75], "level": 0, "parent": null, "vector": [3, 0, 0.1185, 0.0516, 0, 0.66, 0.6957, 512, 0, 4, 0, 0, 186, 0, 4], "semantic": {"name": "OAuthToken", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthToken(object):\n # access tokens and request tokens\n key = None\n secret = None\n\n '''\n key = the token\n secret = the token secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L51_C4", "label": "key =", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [14, 1, 0.0975, 0.0019, 1, 0.09, 0.0, 230, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L52_C4", "label": "secret =", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [14, 1, 0.0994, 0.0019, 1, 0.09, 0.1667, 189, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L54_C4", "label": "expression", "type": "expression", "loc": [54, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [8, 1, 0.1061, 0.0076, 1, 0.09, 0.3333, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n key = the token\n secret = the token secret\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4", "label": "__init__", "type": "function", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [2, 1, 0.1128, 0.0057, 1, 0.09, 0.5, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "key", "secret"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, key, secret):\n self.key = key\n self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L59_C8", "label": "self.key =", "type": "assigned_variable", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4", "vector": [14, 2, 0.1128, 0.0019, 2, 0.36, 0.0, 605, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.key = key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L60_C8", "label": "self.secret =", "type": "assigned_variable", "loc": [60, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4", "vector": [14, 2, 0.1147, 0.0019, 2, 0.36, 1.0, 208, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.secret = secret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L62_C4", "label": "to_string", "type": "function", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [2, 1, 0.1195, 0.0038, 1, 0.09, 0.6667, 549, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "to_string", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_string(self):\n return urllib.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L63_C8", "label": "return", "type": "return", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L62_C4", "vector": [13, 2, 0.1205, 0.0019, 2, 0.9, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return urllib.urlencode({'oauth_token': self.key, 'oauth_token_secret': self.secret})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "label": "from_string", "type": "function", "loc": [68, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [2, 1, 0.1338, 0.0096, 1, 0.09, 0.8333, 423, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "from_string", "arg_names": ["s"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_string(s):\n params = cgi.parse_qs(s, keep_blank_values=False)\n key = params['oauth_token'][0]\n secret = params['oauth_token_secret'][0]\n return OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L69_C8", "label": "params = parse_qs()", "type": "assigned_variable", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "vector": [14, 2, 0.1319, 0.0019, 2, 0.73, 0.0, 206, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " params = cgi.parse_qs(s, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L70_C8", "label": "key =", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "vector": [14, 2, 0.1338, 0.0019, 2, 0.73, 0.3333, 230, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = params['oauth_token'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L71_C8", "label": "secret =", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "vector": [14, 2, 0.1358, 0.0019, 2, 0.73, 0.6667, 189, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "secret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " secret = params['oauth_token_secret'][0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L72_C8", "label": "return", "type": "return", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "vector": [13, 2, 0.1377, 0.0019, 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 OAuthToken(key, secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L74_C4", "label": "__str__", "type": "function", "loc": [74, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "vector": [2, 1, 0.1424, 0.0038, 1, 0.09, 1.0, 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.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L75_C8", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L74_C4", "vector": [13, 2, 0.1434, 0.0019, 2, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.to_string()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "label": "OAuthRequest", "type": "class", "loc": [78, 261], "level": 0, "parent": null, "vector": [3, 0, 0.3241, 0.3518, 0, 0.66, 0.7391, 101, 0, 18, 0, 0, 186, 0, 55], "semantic": {"name": "OAuthRequest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthRequest(object):\n '''\n OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature \n - oauth_timestamp "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L79_C4", "label": "expression", "type": "expression", "loc": [79, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [8, 1, 0.1606, 0.021, 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 OAuth parameters:\n - oauth_consumer_key \n - oauth_token\n - oauth_signature_method\n - oauth_signature \n - oauth_timestamp \n - oauth_nonce"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L90_C4", "label": "parameters =", "type": "assigned_variable", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [14, 1, 0.1721, 0.0019, 1, 0.58, 0.0455, 29, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = None # oauth parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L91_C4", "label": "http_method =", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [14, 1, 0.174, 0.0019, 1, 0.58, 0.0909, 19, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_method = HTTP_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L92_C4", "label": "http_url =", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [14, 1, 0.1759, 0.0019, 1, 0.58, 0.1364, 630, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " http_url = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L93_C4", "label": "version =", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [14, 1, 0.1778, 0.0019, 1, 0.58, 0.1818, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "label": "__init__", "type": "function", "loc": [95, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.1845, 0.0076, 1, 0.58, 0.2273, 555, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, http_method=HTTP_METHOD, http_url=None, parameters=None):\n self.http_method = http_method\n self.http_url = http_url\n self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L96_C8", "label": "self.http_method =", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "vector": [14, 2, 0.1836, 0.0019, 2, 0.4, 0.0, 758, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_method = http_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L97_C8", "label": "self.http_url =", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "vector": [14, 2, 0.1855, 0.0019, 2, 0.4, 0.5, 654, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.http_url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.http_url = http_url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L98_C8", "label": "self.parameters =", "type": "assigned_variable", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "vector": [14, 2, 0.1874, 0.0019, 2, 0.4, 1.0, 721, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters = parameters or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L100_C4", "label": "set_parameter", "type": "function", "loc": [100, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.1922, 0.0038, 1, 0.58, 0.2727, 310, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "set_parameter", "arg_names": ["self", "parameter", "value"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_parameter(self, parameter, value):\n self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L101_C8", "label": "assign", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L100_C4", "vector": [14, 2, 0.1931, 0.0019, 2, 0.44, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.parameters[parameter] = value"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L103_C4", "label": "get_parameter", "type": "function", "loc": [103, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2008, 0.0096, 1, 0.58, 0.3182, 386, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_parameter", "arg_names": ["self", "parameter"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_parameter(self, parameter):\n try:\n return self.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L104_C8", "label": "try", "type": "try", "loc": [104, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L103_C4", "vector": [7, 2, 0.2017, 0.0076, 2, 0.08, 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.parameters[parameter]\n except:\n raise OAuthError('Parameter not found: %s' % parameter)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L105_C12", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L104_C8", "vector": [13, 3, 0.2008, 0.0019, 3, 0.42, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.parameters[parameter]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L109_C4", "label": "_get_timestamp_nonce", "type": "function", "loc": [109, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2094, 0.0038, 1, 0.58, 0.3636, 211, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "_get_timestamp_nonce", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_timestamp_nonce(self):\n return self.get_parameter('oauth_timestamp'), self.get_parameter('oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L110_C8", "label": "return", "type": "return", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L109_C4", "vector": [13, 2, 0.2103, 0.0019, 2, 0.97, 0.0, 0, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.get_parameter('oauth_timestamp'), self.get_parameter('oauth_nonce')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "label": "get_nonoauth_parameters", "type": "function", "loc": [113, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2218, 0.0134, 1, 0.58, 0.4091, 748, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "get_nonoauth_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_nonoauth_parameters(self):\n parameters = {}\n for k, v in self.parameters.iteritems():\n # ignore oauth parameters\n if k.find('oauth_') < 0:\n parameters[k] = v\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L114_C8", "label": "parameters =", "type": "assigned_variable", "loc": [114, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "vector": [14, 2, 0.218, 0.0019, 2, 0.94, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L115_C8", "label": "for k, v", "type": "for", "loc": [115, 118], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "vector": [6, 2, 0.2228, 0.0076, 2, 0.94, 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 self.parameters.iteritems():\n # ignore oauth parameters\n if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L117_C12", "label": "if", "type": "if", "loc": [117, 118], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L115_C8", "vector": [4, 3, 0.2247, 0.0038, 3, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if k.find('oauth_') < 0:\n parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L118_C16", "label": "assign", "type": "assigned_variable", "loc": [118, 118], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L117_C12", "vector": [14, 4, 0.2256, 0.0019, 4, 0.67, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters[k] = v"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L119_C8", "label": "return", "type": "return", "loc": [119, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "vector": [13, 2, 0.2275, 0.0019, 2, 0.94, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "label": "to_header", "type": "function", "loc": [122, 128], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.239, 0.0134, 1, 0.58, 0.4545, 578, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "to_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_header(self, realm=''):\n auth_header = 'OAuth realm=\"%s\"' % realm\n # add the oauth parameters\n if self.parameters:\n for k, v in self.parameters.iteritems():\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))\n return {'Authorization': auth_header}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L123_C8", "label": "auth_header =", "type": "assigned_variable", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "vector": [14, 2, 0.2352, 0.0019, 2, 0.66, 0.0, 774, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = 'OAuth realm=\"%s\"' % realm"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L125_C8", "label": "if", "type": "if", "loc": [125, 127], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "vector": [4, 2, 0.2409, 0.0057, 2, 0.66, 0.5, 0, 7, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.parameters:\n for k, v in self.parameters.iteritems():\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L126_C12", "label": "for k, v", "type": "for", "loc": [126, 127], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L125_C8", "vector": [6, 3, 0.2419, 0.0038, 3, 0.67, 0.0, 867, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "k, v", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k, v in self.parameters.iteritems():\n auth_header += ', %s=\"%s\"' % (k, escape(str(v)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L128_C8", "label": "return", "type": "return", "loc": [128, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "vector": [13, 2, 0.2447, 0.0019, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'Authorization': auth_header}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L131_C4", "label": "to_postdata", "type": "function", "loc": [131, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2514, 0.0038, 1, 0.58, 0.5, 745, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "to_postdata", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_postdata(self):\n return '&'.join('%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.iteritems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L132_C8", "label": "return", "type": "return", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L131_C4", "vector": [13, 2, 0.2524, 0.0019, 2, 0.31, 0.0, 0, 3, 0, 0, 0, 0, 10, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join('%s=%s' % (escape(str(k)), escape(str(v))) for k, v in self.parameters.iteritems())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L135_C4", "label": "to_url", "type": "function", "loc": [135, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2591, 0.0038, 1, 0.58, 0.5455, 212, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "to_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def to_url(self):\n return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L136_C8", "label": "return", "type": "return", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L135_C4", "vector": [13, 2, 0.26, 0.0019, 2, 0.25, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s?%s' % (self.get_normalized_http_url(), self.to_postdata())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "label": "get_normalized_parameters", "type": "function", "loc": [139, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2763, 0.0229, 1, 0.58, 0.5909, 230, 0, 1, 1, 0, 0, 0, 7], "semantic": {"name": "get_normalized_parameters", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_parameters(self):\n params = self.parameters\n try:\n # exclude the signature if it exists\n del params['oauth_signature']\n except:\n pass\n key_values = params.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L140_C8", "label": "params =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "vector": [14, 2, 0.2677, 0.0019, 2, 0.56, 0.0, 206, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = self.parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L141_C8", "label": "try", "type": "try", "loc": [141, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "vector": [7, 2, 0.2734, 0.0096, 2, 0.56, 0.25, 0, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # exclude the signature if it exists\n del params['oauth_signature']\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L146_C8", "label": "key_values = items()", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "vector": [14, 2, 0.2792, 0.0019, 2, 0.56, 0.5, 287, 3, 0, 0, 0, 339, 10, 1], "semantic": {"name": "key_values", "arg_names": [], "import_names": [], "rhs_call_name": "items", "annotation": ""}, "snippet": " key_values = params.items()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L148_C8", "label": "sort()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "vector": [8, 2, 0.283, 0.0019, 2, 0.56, 0.75, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " key_values.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L150_C8", "label": "return", "type": "return", "loc": [150, 150], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "vector": [13, 2, 0.2868, 0.0019, 2, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '&'.join('%s=%s' % (escape(str(k)), escape(str(v))) for k, v in key_values)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L153_C4", "label": "get_normalized_http_method", "type": "function", "loc": [153, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.2935, 0.0038, 1, 0.58, 0.6364, 554, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_method", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_method(self):\n return self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L154_C8", "label": "return", "type": "return", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L153_C4", "vector": [13, 2, 0.2945, 0.0019, 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 self.http_method.upper()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "label": "get_normalized_http_url", "type": "function", "loc": [157, 160], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.3031, 0.0076, 1, 0.58, 0.6818, 60, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_normalized_http_url", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_normalized_http_url(self):\n parts = urlparse.urlparse(self.http_url)\n url_string = '%s://%s%s' % (parts[0], parts[1], parts[2]) # scheme, netloc, path\n return url_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L158_C8", "label": "parts = urlparse()", "type": "assigned_variable", "loc": [158, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "vector": [14, 2, 0.3021, 0.0019, 2, 0.03, 0.0, 13, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " parts = urlparse.urlparse(self.http_url)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L159_C8", "label": "url_string =", "type": "assigned_variable", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "vector": [14, 2, 0.304, 0.0019, 2, 0.03, 0.5, 446, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url_string", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url_string = '%s://%s%s' % (parts[0], parts[1], parts[2]) # scheme, netloc, path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L160_C8", "label": "return", "type": "return", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "vector": [13, 2, 0.3059, 0.0019, 2, 0.03, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return url_string"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4", "label": "sign_request", "type": "function", "loc": [163, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.3155, 0.0096, 1, 0.58, 0.7273, 817, 0, 4, 0, 0, 0, 0, 4], "semantic": {"name": "sign_request", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def sign_request(self, signature_method, consumer, token):\n # set the signature method\n self.set_parameter('oauth_signature_method', signature_method.get_name())\n # set the signature\n self.set_parameter('oauth_signature', self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L165_C8", "label": "set_parameter()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4", "vector": [8, 2, 0.3155, 0.0019, 2, 0.7, 0.0, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature_method', signature_method.get_name())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L167_C8", "label": "set_parameter()", "type": "expression", "loc": [167, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4", "vector": [8, 2, 0.3193, 0.0019, 2, 0.7, 1.0, 310, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "set_parameter", "arg_names": [], "import_names": [], "rhs_call_name": "set_parameter", "annotation": ""}, "snippet": " self.set_parameter('oauth_signature', self.build_signature(signature_method, consumer, token))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L169_C4", "label": "build_signature", "type": "function", "loc": [169, 171], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.325, 0.0057, 1, 0.58, 0.7727, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "signature_method", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, signature_method, consumer, token):\n # call the build signature method within the signature method\n return signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L171_C8", "label": "return", "type": "return", "loc": [171, 171], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L169_C4", "vector": [13, 2, 0.327, 0.0019, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return signature_method.build_signature(self, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "label": "from_request", "type": "function", "loc": [174, 204], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.3614, 0.0593, 1, 0.58, 0.8182, 713, 0, 5, 1, 0, 0, 0, 10], "semantic": {"name": "from_request", "arg_names": ["http_method", "http_url", "headers", "parameters", "query_string"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_request(http_method, http_url, headers=None, parameters=None, query_string=None):\n # combine multiple parameter sources\n if parameters is None:\n parameters = {}\n\n # headers\n if headers and 'Authorization' in headers:\n auth_header = headers['Authorization']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L176_C8", "label": "if", "type": "if", "loc": [176, 177], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [4, 2, 0.3375, 0.0038, 2, 0.53, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters is None:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L177_C12", "label": "parameters =", "type": "assigned_variable", "loc": [177, 177], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L176_C8", "vector": [14, 3, 0.3384, 0.0019, 3, 0.72, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8", "label": "if", "type": "if", "loc": [180, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [4, 2, 0.3528, 0.0191, 2, 0.53, 0.1429, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if headers and 'Authorization' in headers:\n auth_header = headers['Authorization']\n # check that the authorization header is OAuth\n if auth_header.index('OAuth') > -1:\n try:\n # get the parameters from the header\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L181_C12", "label": "auth_header =", "type": "assigned_variable", "loc": [181, 181], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8", "vector": [14, 3, 0.3461, 0.0019, 3, 0.87, 0.0, 774, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_header", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_header = headers['Authorization']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L183_C12", "label": "if", "type": "if", "loc": [183, 189], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8", "vector": [4, 3, 0.3556, 0.0134, 3, 0.87, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if auth_header.index('OAuth') > -1:\n try:\n # get the parameters from the header\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from Authorization header.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16", "label": "try", "type": "try", "loc": [184, 189], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L183_C12", "vector": [7, 4, 0.3566, 0.0115, 4, 0.2, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # get the parameters from the header\n header_params = OAuthRequest._split_header(auth_header)\n parameters.update(header_params)\n except:\n raise OAuthError('Unable to parse OAuth parameters from Authorization header.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L186_C20", "label": "header_params = _split_header()", "type": "assigned_variable", "loc": [186, 186], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16", "vector": [14, 5, 0.3556, 0.0019, 5, 0.13, 0.0, 121, 3, 1, 0, 0, 848, 10, 1], "semantic": {"name": "header_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_header", "annotation": ""}, "snippet": " header_params = OAuthRequest._split_header(auth_header)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L187_C20", "label": "update()", "type": "expression", "loc": [187, 187], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16", "vector": [8, 5, 0.3576, 0.0019, 5, 0.13, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(header_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8", "label": "if", "type": "if", "loc": [192, 194], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [4, 2, 0.369, 0.0057, 2, 0.53, 0.2857, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if query_string:\n query_params = OAuthRequest._split_url_string(query_string)\n parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L193_C12", "label": "query_params = _split_url_string()", "type": "assigned_variable", "loc": [193, 193], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8", "vector": [14, 3, 0.369, 0.0019, 3, 0.42, 0.0, 950, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "query_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " query_params = OAuthRequest._split_url_string(query_string)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L194_C12", "label": "update()", "type": "expression", "loc": [194, 194], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8", "vector": [8, 3, 0.3709, 0.0019, 3, 0.42, 1.0, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(query_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L197_C8", "label": "param_str =", "type": "assigned_variable", "loc": [197, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [14, 2, 0.3767, 0.0019, 2, 0.53, 0.4286, 886, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "param_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " param_str = urlparse.urlparse(http_url)[4] # query"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L198_C8", "label": "url_params = _split_url_string()", "type": "assigned_variable", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [14, 2, 0.3786, 0.0019, 2, 0.53, 0.5714, 664, 3, 1, 0, 0, 90, 10, 1], "semantic": {"name": "url_params", "arg_names": [], "import_names": [], "rhs_call_name": "_split_url_string", "annotation": ""}, "snippet": " url_params = OAuthRequest._split_url_string(param_str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L199_C8", "label": "update()", "type": "expression", "loc": [199, 199], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [8, 2, 0.3805, 0.0019, 2, 0.53, 0.7143, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " parameters.update(url_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L201_C8", "label": "if", "type": "if", "loc": [201, 202], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [4, 2, 0.3853, 0.0038, 2, 0.53, 0.8571, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if parameters:\n return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L202_C12", "label": "return", "type": "return", "loc": [202, 202], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L201_C8", "vector": [13, 3, 0.3862, 0.0019, 3, 0.29, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L204_C8", "label": "return", "type": "return", "loc": [204, 204], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "vector": [13, 2, 0.3901, 0.0019, 2, 0.53, 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_1152:FunctionDef_L207_C4", "label": "from_consumer_and_token", "type": "function", "loc": [207, 224], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.412, 0.0344, 1, 0.58, 0.8636, 319, 0, 5, 1, 0, 0, 0, 4], "semantic": {"name": "from_consumer_and_token", "arg_names": ["oauth_consumer", "token", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_consumer_and_token(oauth_consumer, token=None, http_method=HTTP_METHOD, http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n defaults = {\n 'oauth_consumer_key': oauth_consumer.key,\n 'oauth_timestamp': generate_timestamp(),\n 'oauth_nonce': generate_nonce(),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L208_C8", "label": "if", "type": "if", "loc": [208, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [4, 2, 0.3987, 0.0038, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L209_C12", "label": "parameters =", "type": "assigned_variable", "loc": [209, 209], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L208_C8", "vector": [14, 3, 0.3996, 0.0019, 3, 0.49, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L211_C8", "label": "defaults =", "type": "assigned_variable", "loc": [211, 216], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [14, 2, 0.4082, 0.0115, 2, 0.77, 0.2, 233, 0, 0, 0, 0, 0, 6, 2], "semantic": {"name": "defaults", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " defaults = {\n 'oauth_consumer_key': oauth_consumer.key,\n 'oauth_timestamp': generate_timestamp(),\n 'oauth_nonce': generate_nonce(),\n 'oauth_version': OAuthRequest.version,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L218_C8", "label": "update()", "type": "expression", "loc": [218, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [8, 2, 0.4168, 0.0019, 2, 0.77, 0.4, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " defaults.update(parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L219_C8", "label": "parameters =", "type": "assigned_variable", "loc": [219, 219], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [14, 2, 0.4187, 0.0019, 2, 0.77, 0.6, 29, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = defaults"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L221_C8", "label": "if", "type": "if", "loc": [221, 222], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [4, 2, 0.4235, 0.0038, 2, 0.77, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L222_C12", "label": "assign", "type": "assigned_variable", "loc": [222, 222], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L221_C8", "vector": [14, 3, 0.4245, 0.0019, 3, 0.2, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L224_C8", "label": "return", "type": "return", "loc": [224, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "vector": [13, 2, 0.4283, 0.0019, 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 OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "label": "from_token_and_callback", "type": "function", "loc": [227, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.4426, 0.0191, 1, 0.58, 0.9091, 823, 0, 5, 1, 0, 0, 0, 2], "semantic": {"name": "from_token_and_callback", "arg_names": ["token", "callback", "http_method", "http_url", "parameters"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def from_token_and_callback(token, callback=None, http_method=HTTP_METHOD, http_url=None, parameters=None):\n if not parameters:\n parameters = {}\n\n parameters['oauth_token'] = token.key\n\n if callback:\n parameters['oauth_callback'] = escape(callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L228_C8", "label": "if", "type": "if", "loc": [228, 229], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "vector": [4, 2, 0.4369, 0.0038, 2, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not parameters:\n parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L229_C12", "label": "parameters =", "type": "assigned_variable", "loc": [229, 229], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L228_C8", "vector": [14, 3, 0.4379, 0.0019, 3, 0.56, 0.0, 29, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L231_C8", "label": "assign", "type": "assigned_variable", "loc": [231, 231], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "vector": [14, 2, 0.4417, 0.0019, 2, 0.02, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parameters['oauth_token'] = token.key"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L233_C8", "label": "if", "type": "if", "loc": [233, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "vector": [4, 2, 0.4465, 0.0038, 2, 0.02, 0.6667, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if callback:\n parameters['oauth_callback'] = escape(callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L234_C12", "label": " = escape()", "type": "assigned_variable", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L233_C8", "vector": [14, 3, 0.4474, 0.0019, 3, 0.44, 0.0, 0, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": " parameters['oauth_callback'] = escape(callback)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L236_C8", "label": "return", "type": "return", "loc": [236, 236], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "vector": [13, 2, 0.4512, 0.0019, 2, 0.02, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return OAuthRequest(http_method, http_url, parameters)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "label": "_split_header", "type": "function", "loc": [240, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.4713, 0.0268, 1, 0.58, 0.9545, 848, 0, 1, 1, 0, 0, 0, 6], "semantic": {"name": "_split_header", "arg_names": ["header"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_header(header):\n params = {}\n parts = header.split(',')\n for param in parts:\n # ignore realm parameter\n if param.find('OAuth realm') > -1:\n continue\n # remove whitespace"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L241_C8", "label": "params =", "type": "assigned_variable", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "vector": [14, 2, 0.4608, 0.0019, 2, 0.44, 0.0, 206, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " params = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L242_C8", "label": "parts = split()", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "vector": [14, 2, 0.4627, 0.0019, 2, 0.44, 0.3333, 13, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " parts = header.split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "label": "for param", "type": "for", "loc": [243, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "vector": [6, 2, 0.4732, 0.0191, 2, 0.44, 0.6667, 841, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for param in parts:\n # ignore realm parameter\n if param.find('OAuth realm') > -1:\n continue\n # remove whitespace\n param = param.strip()\n # split key-value\n param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L245_C12", "label": "if", "type": "if", "loc": [245, 246], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "vector": [4, 3, 0.4694, 0.0038, 3, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if param.find('OAuth realm') > -1:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L248_C12", "label": "param = strip()", "type": "assigned_variable", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "vector": [14, 3, 0.4742, 0.0019, 3, 0.14, 0.3333, 841, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "param", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " param = param.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L250_C12", "label": "param_parts = split()", "type": "assigned_variable", "loc": [250, 250], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "vector": [14, 3, 0.478, 0.0019, 3, 0.14, 0.6667, 328, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "param_parts", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " param_parts = param.split('=', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L252_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [252, 252], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "vector": [14, 3, 0.4818, 0.0019, 3, 0.14, 1.0, 0, 3, 1, 0, 0, 432, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " params[param_parts[0]] = urllib.unquote(param_parts[1].strip('\\\"'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L253_C8", "label": "return", "type": "return", "loc": [253, 253], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "vector": [13, 2, 0.4837, 0.0019, 2, 0.44, 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_1152:FunctionDef_L257_C4", "label": "_split_url_string", "type": "function", "loc": [257, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "vector": [2, 1, 0.4952, 0.0096, 1, 0.58, 1.0, 90, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_split_url_string", "arg_names": ["param_str"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _split_url_string(param_str):\n parameters = cgi.parse_qs(param_str, keep_blank_values=False)\n for k, v in parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])\n return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L258_C8", "label": "parameters = parse_qs()", "type": "assigned_variable", "loc": [258, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "vector": [14, 2, 0.4933, 0.0019, 2, 0.9, 0.0, 29, 3, 2, 0, 0, 709, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "parse_qs", "annotation": ""}, "snippet": " parameters = cgi.parse_qs(param_str, keep_blank_values=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L259_C8", "label": "for k, v", "type": "for", "loc": [259, 260], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "vector": [6, 2, 0.4962, 0.0038, 2, 0.9, 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 parameters.iteritems():\n parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L260_C12", "label": " = unquote()", "type": "assigned_variable", "loc": [260, 260], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L259_C8", "vector": [14, 3, 0.4971, 0.0019, 3, 0.41, 0.0, 0, 3, 1, 0, 0, 432, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "unquote", "annotation": ""}, "snippet": " parameters[k] = urllib.unquote(v[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L261_C8", "label": "return", "type": "return", "loc": [261, 261], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "vector": [13, 2, 0.499, 0.0019, 2, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "label": "OAuthServer", "type": "class", "loc": [264, 403], "level": 0, "parent": null, "vector": [3, 0, 0.6377, 0.2677, 0, 0.66, 0.7826, 779, 0, 17, 0, 0, 186, 0, 49], "semantic": {"name": "OAuthServer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthServer(object):\n timestamp_threshold = 300 # in seconds, five minutes\n version = VERSION\n signature_methods = None\n data_store = None\n\n def __init__(self, data_store=None, signature_methods=None):\n self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L265_C4", "label": "timestamp_threshold =", "type": "assigned_variable", "loc": [265, 265], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [14, 1, 0.5067, 0.0019, 1, 0.43, 0.0, 129, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "timestamp_threshold", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " timestamp_threshold = 300 # in seconds, five minutes"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L266_C4", "label": "version =", "type": "assigned_variable", "loc": [266, 266], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [14, 1, 0.5086, 0.0019, 1, 0.43, 0.05, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L267_C4", "label": "signature_methods =", "type": "assigned_variable", "loc": [267, 267], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [14, 1, 0.5105, 0.0019, 1, 0.43, 0.1, 544, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_methods = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L268_C4", "label": "data_store =", "type": "assigned_variable", "loc": [268, 268], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [14, 1, 0.5124, 0.0019, 1, 0.43, 0.15, 82, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " data_store = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4", "label": "__init__", "type": "function", "loc": [270, 272], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5182, 0.0057, 1, 0.43, 0.2, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "data_store", "signature_methods"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, data_store=None, signature_methods=None):\n self.data_store = data_store\n self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L271_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [271, 271], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4", "vector": [14, 2, 0.5182, 0.0019, 2, 0.38, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L272_C8", "label": "self.signature_methods =", "type": "assigned_variable", "loc": [272, 272], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4", "vector": [14, 2, 0.5201, 0.0019, 2, 0.38, 1.0, 94, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.signature_methods", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods = signature_methods or {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L274_C4", "label": "set_data_store", "type": "function", "loc": [274, 275], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5249, 0.0038, 1, 0.43, 0.25, 928, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "set_data_store", "arg_names": ["self", "oauth_data_store"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def set_data_store(self, oauth_data_store):\n self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L275_C8", "label": "self.data_store =", "type": "assigned_variable", "loc": [275, 275], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L274_C4", "vector": [14, 2, 0.5258, 0.0019, 2, 0.75, 0.0, 118, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.data_store", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.data_store = data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L277_C4", "label": "get_data_store", "type": "function", "loc": [277, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5306, 0.0038, 1, 0.43, 0.3, 473, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_data_store", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_data_store(self):\n return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L278_C8", "label": "return", "type": "return", "loc": [278, 278], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L277_C4", "vector": [13, 2, 0.5315, 0.0019, 2, 0.14, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4", "label": "add_signature_method", "type": "function", "loc": [280, 282], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5373, 0.0057, 1, 0.43, 0.35, 134, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "add_signature_method", "arg_names": ["self", "signature_method"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def add_signature_method(self, signature_method):\n self.signature_methods[signature_method.get_name()] = signature_method\n return self.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L281_C8", "label": "assign", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4", "vector": [14, 2, 0.5373, 0.0019, 2, 0.97, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.signature_methods[signature_method.get_name()] = signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L282_C8", "label": "return", "type": "return", "loc": [282, 282], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4", "vector": [13, 2, 0.5392, 0.0019, 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.signature_methods"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4", "label": "fetch_request_token", "type": "function", "loc": [286, 297], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5574, 0.0229, 1, 0.43, 0.4, 255, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n try:\n # get the request token for authorization\n token = self._get_token(oauth_request, 'request')\n except OAuthError:\n # no token required for the initial token request\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "label": "try", "type": "try", "loc": [287, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4", "vector": [7, 2, 0.5574, 0.0191, 2, 0.19, 0.0, 0, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # get the request token for authorization\n token = self._get_token(oauth_request, 'request')\n except OAuthError:\n # no token required for the initial token request\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n self._check_signature(oauth_request, consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L289_C12", "label": "token = _get_token()", "type": "assigned_variable", "loc": [289, 289], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "vector": [14, 3, 0.5526, 0.0019, 3, 0.27, 0.0, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L292_C12", "label": "version = _get_version()", "type": "assigned_variable", "loc": [292, 292], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "vector": [14, 3, 0.5583, 0.0019, 3, 0.27, 0.0, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L293_C12", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [293, 293], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "vector": [14, 3, 0.5602, 0.0019, 3, 0.27, 0.3333, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L294_C12", "label": "_check_signature()", "type": "expression", "loc": [294, 294], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "vector": [8, 3, 0.5621, 0.0019, 3, 0.27, 0.6667, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, None)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L296_C12", "label": "token = fetch_request_token()", "type": "assigned_variable", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "vector": [14, 3, 0.566, 0.0019, 3, 0.27, 1.0, 129, 3, 1, 0, 0, 255, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_request_token", "annotation": ""}, "snippet": " token = self.data_store.fetch_request_token(consumer)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L297_C8", "label": "return", "type": "return", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4", "vector": [13, 2, 0.5679, 0.0019, 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 token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "label": "fetch_access_token", "type": "function", "loc": [301, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.5822, 0.0153, 1, 0.43, 0.45, 413, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n # get the request token\n token = self._get_token(oauth_request, 'request')\n self._check_signature(oauth_request, consumer, token)\n new_token = self.data_store.fetch_access_token(consumer, token)\n return new_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L302_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [302, 302], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [14, 2, 0.5774, 0.0019, 2, 0.49, 0.0, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L303_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [303, 303], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [14, 2, 0.5793, 0.0019, 2, 0.49, 0.2, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L305_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [14, 2, 0.5832, 0.0019, 2, 0.49, 0.4, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L306_C8", "label": "_check_signature()", "type": "expression", "loc": [306, 306], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [8, 2, 0.5851, 0.0019, 2, 0.49, 0.6, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L307_C8", "label": "new_token = fetch_access_token()", "type": "assigned_variable", "loc": [307, 307], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [14, 2, 0.587, 0.0019, 2, 0.49, 0.8, 945, 3, 2, 0, 0, 413, 10, 1], "semantic": {"name": "new_token", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_access_token", "annotation": ""}, "snippet": " new_token = self.data_store.fetch_access_token(consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L308_C8", "label": "return", "type": "return", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "vector": [13, 2, 0.5889, 0.0019, 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 new_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "label": "verify_request", "type": "function", "loc": [311, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6023, 0.0172, 1, 0.43, 0.5, 168, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "verify_request", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def verify_request(self, oauth_request):\n # -> consumer and token\n version = self._get_version(oauth_request)\n consumer = self._get_consumer(oauth_request)\n # get the access token\n token = self._get_token(oauth_request, 'access')\n self._check_signature(oauth_request, consumer, token)\n parameters = oauth_request.get_nonoauth_parameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L313_C8", "label": "version = _get_version()", "type": "assigned_variable", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [14, 2, 0.5985, 0.0019, 2, 0.11, 0.0, 623, 3, 1, 0, 0, 602, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "_get_version", "annotation": ""}, "snippet": " version = self._get_version(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L314_C8", "label": "consumer = _get_consumer()", "type": "assigned_variable", "loc": [314, 314], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [14, 2, 0.6004, 0.0019, 2, 0.11, 0.2, 352, 3, 1, 0, 0, 561, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "_get_consumer", "annotation": ""}, "snippet": " consumer = self._get_consumer(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L316_C8", "label": "token = _get_token()", "type": "assigned_variable", "loc": [316, 316], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [14, 2, 0.6042, 0.0019, 2, 0.11, 0.4, 129, 3, 2, 0, 0, 917, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "_get_token", "annotation": ""}, "snippet": " token = self._get_token(oauth_request, 'access')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L317_C8", "label": "_check_signature()", "type": "expression", "loc": [317, 317], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [8, 2, 0.6061, 0.0019, 2, 0.11, 0.6, 740, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_signature", "arg_names": [], "import_names": [], "rhs_call_name": "_check_signature", "annotation": ""}, "snippet": " self._check_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L318_C8", "label": "parameters = get_nonoauth_parameters()", "type": "assigned_variable", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [14, 2, 0.608, 0.0019, 2, 0.11, 0.8, 29, 3, 0, 0, 0, 748, 10, 1], "semantic": {"name": "parameters", "arg_names": [], "import_names": [], "rhs_call_name": "get_nonoauth_parameters", "annotation": ""}, "snippet": " parameters = oauth_request.get_nonoauth_parameters()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L319_C8", "label": "return", "type": "return", "loc": [319, 319], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "vector": [13, 2, 0.6099, 0.0019, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return consumer, token, parameters"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L322_C4", "label": "authorize_token", "type": "function", "loc": [322, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6166, 0.0038, 1, 0.43, 0.55, 36, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "authorize_token", "arg_names": ["self", "token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_token(self, token, user):\n return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L323_C8", "label": "return", "type": "return", "loc": [323, 323], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L322_C4", "vector": [13, 2, 0.6176, 0.0019, 2, 0.54, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self.data_store.authorize_request_token(token, user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L326_C4", "label": "get_callback", "type": "function", "loc": [326, 327], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6243, 0.0038, 1, 0.43, 0.6, 564, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "get_callback", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_callback(self, oauth_request):\n return oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L327_C8", "label": "return", "type": "return", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L326_C4", "vector": [13, 2, 0.6252, 0.0019, 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 oauth_request.get_parameter('oauth_callback')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L330_C4", "label": "build_authenticate_header", "type": "function", "loc": [330, 331], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6319, 0.0038, 1, 0.43, 0.65, 279, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "build_authenticate_header", "arg_names": ["self", "realm"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_authenticate_header(self, realm=''):\n return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L331_C8", "label": "return", "type": "return", "loc": [331, 331], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L330_C4", "vector": [13, 2, 0.6329, 0.0019, 2, 0.52, 0.0, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return {'WWW-Authenticate': 'OAuth realm=\"%s\"' % realm}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "label": "_get_version", "type": "function", "loc": [334, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6453, 0.0153, 1, 0.43, 0.7, 602, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_get_version", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_version(self, oauth_request):\n try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION\n if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))\n return version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8", "label": "try", "type": "try", "loc": [335, 338], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "vector": [7, 2, 0.6434, 0.0076, 2, 0.29, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n version = oauth_request.get_parameter('oauth_version')\n except:\n version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L336_C12", "label": "version = get_parameter()", "type": "assigned_variable", "loc": [336, 336], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8", "vector": [14, 3, 0.6424, 0.0019, 3, 0.32, 0.0, 623, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " version = oauth_request.get_parameter('oauth_version')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L338_C12", "label": "version =", "type": "assigned_variable", "loc": [338, 338], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8", "vector": [14, 3, 0.6463, 0.0019, 3, 0.32, 0.0, 623, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " version = VERSION"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L339_C8", "label": "if", "type": "if", "loc": [339, 340], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "vector": [4, 2, 0.6491, 0.0038, 2, 0.29, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if version and version != self.version:\n raise OAuthError('OAuth version %s not supported.' % str(version))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L341_C8", "label": "return", "type": "return", "loc": [341, 341], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "vector": [13, 2, 0.652, 0.0019, 2, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return version"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "label": "_get_signature_method", "type": "function", "loc": [344, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6692, 0.0249, 1, 0.43, 0.75, 261, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_signature_method", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_signature_method(self, oauth_request):\n try:\n signature_method = oauth_request.get_parameter('oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD\n try:\n # get the signature method object\n signature_method = self.signature_methods[signature_method]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8", "label": "try", "type": "try", "loc": [345, 348], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "vector": [7, 2, 0.6625, 0.0076, 2, 0.05, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature_method = oauth_request.get_parameter('oauth_signature_method')\n except:\n signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L346_C12", "label": "signature_method = get_parameter()", "type": "assigned_variable", "loc": [346, 346], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8", "vector": [14, 3, 0.6616, 0.0019, 3, 0.46, 0.0, 352, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature_method = oauth_request.get_parameter('oauth_signature_method')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L348_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [348, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8", "vector": [14, 3, 0.6654, 0.0019, 3, 0.46, 0.0, 352, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = SIGNATURE_METHOD"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8", "label": "try", "type": "try", "loc": [349, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "vector": [7, 2, 0.6721, 0.0115, 2, 0.05, 0.5, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n # get the signature method object\n signature_method = self.signature_methods[signature_method]\n except:\n signature_method_names = ', '.join(self.signature_methods.keys())\n raise OAuthError('Signature method %s not supported try one of the following: %s' % (signature_method, signature_method_names))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L351_C12", "label": "signature_method =", "type": "assigned_variable", "loc": [351, 351], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8", "vector": [14, 3, 0.6711, 0.0019, 3, 0.7, 0.0, 352, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " signature_method = self.signature_methods[signature_method]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L353_C12", "label": "signature_method_names = join()", "type": "assigned_variable", "loc": [353, 353], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8", "vector": [14, 3, 0.675, 0.0019, 3, 0.7, 0.0, 896, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "signature_method_names", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " signature_method_names = ', '.join(self.signature_methods.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L356_C8", "label": "return", "type": "return", "loc": [356, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "vector": [13, 2, 0.6807, 0.0019, 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 signature_method"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "label": "_get_consumer", "type": "function", "loc": [358, 365], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.6912, 0.0153, 1, 0.43, 0.8, 561, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "_get_consumer", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_consumer(self, oauth_request):\n consumer_key = oauth_request.get_parameter('oauth_consumer_key')\n if not consumer_key:\n raise OAuthError('Invalid consumer key.')\n consumer = self.data_store.lookup_consumer(consumer_key)\n if not consumer:\n raise OAuthError('Invalid consumer.')\n return consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L359_C8", "label": "consumer_key = get_parameter()", "type": "assigned_variable", "loc": [359, 359], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "vector": [14, 2, 0.6864, 0.0019, 2, 0.51, 0.0, 353, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "consumer_key", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " consumer_key = oauth_request.get_parameter('oauth_consumer_key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L360_C8", "label": "if", "type": "if", "loc": [360, 361], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "vector": [4, 2, 0.6893, 0.0038, 2, 0.51, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer_key:\n raise OAuthError('Invalid consumer key.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L362_C8", "label": "consumer = lookup_consumer()", "type": "assigned_variable", "loc": [362, 362], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "vector": [14, 2, 0.6922, 0.0019, 2, 0.51, 0.5, 352, 3, 1, 0, 0, 718, 10, 1], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_consumer", "annotation": ""}, "snippet": " consumer = self.data_store.lookup_consumer(consumer_key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L363_C8", "label": "if", "type": "if", "loc": [363, 364], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "vector": [4, 2, 0.695, 0.0038, 2, 0.51, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not consumer:\n raise OAuthError('Invalid consumer.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L365_C8", "label": "return", "type": "return", "loc": [365, 365], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "vector": [13, 2, 0.6979, 0.0019, 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 consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "label": "_get_token", "type": "function", "loc": [368, 373], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.7084, 0.0115, 1, 0.43, 0.85, 917, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_get_token", "arg_names": ["self", "oauth_request", "token_type"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _get_token(self, oauth_request, token_type='access'):\n token_field = oauth_request.get_parameter('oauth_token')\n token = self.data_store.lookup_token(token_type, token_field)\n if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))\n return token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L369_C8", "label": "token_field = get_parameter()", "type": "assigned_variable", "loc": [369, 369], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "vector": [14, 2, 0.7055, 0.0019, 2, 0.05, 0.0, 531, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "token_field", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " token_field = oauth_request.get_parameter('oauth_token')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L370_C8", "label": "token = lookup_token()", "type": "assigned_variable", "loc": [370, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "vector": [14, 2, 0.7075, 0.0019, 2, 0.05, 0.3333, 129, 3, 2, 0, 0, 87, 10, 1], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_token", "annotation": ""}, "snippet": " token = self.data_store.lookup_token(token_type, token_field)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L371_C8", "label": "if", "type": "if", "loc": [371, 372], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "vector": [4, 2, 0.7103, 0.0038, 2, 0.05, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not token:\n raise OAuthError('Invalid %s token: %s' % (token_type, token_field))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L373_C8", "label": "return", "type": "return", "loc": [373, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "vector": [13, 2, 0.7132, 0.0019, 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 token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "label": "_check_signature", "type": "function", "loc": [375, 389], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.7304, 0.0287, 1, 0.43, 0.9, 740, 0, 4, 0, 0, 0, 0, 10], "semantic": {"name": "_check_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_signature(self, oauth_request, consumer, token):\n timestamp, nonce = oauth_request._get_timestamp_nonce()\n self._check_timestamp(timestamp)\n self._check_nonce(consumer, token, nonce)\n signature_method = self._get_signature_method(oauth_request)\n try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L376_C8", "label": "timestamp, nonce = _get_timestamp_nonce()", "type": "assigned_variable", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [14, 2, 0.7189, 0.0019, 2, 0.86, 0.0, 88, 3, 0, 0, 0, 211, 10, 1], "semantic": {"name": "timestamp, nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_get_timestamp_nonce", "annotation": ""}, "snippet": " timestamp, nonce = oauth_request._get_timestamp_nonce()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L377_C8", "label": "_check_timestamp()", "type": "expression", "loc": [377, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [8, 2, 0.7208, 0.0019, 2, 0.86, 0.1429, 607, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "_check_timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "_check_timestamp", "annotation": ""}, "snippet": " self._check_timestamp(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L378_C8", "label": "_check_nonce()", "type": "expression", "loc": [378, 378], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [8, 2, 0.7228, 0.0019, 2, 0.86, 0.2857, 731, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "_check_nonce", "arg_names": [], "import_names": [], "rhs_call_name": "_check_nonce", "annotation": ""}, "snippet": " self._check_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L379_C8", "label": "signature_method = _get_signature_method()", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [14, 2, 0.7247, 0.0019, 2, 0.86, 0.4286, 352, 3, 1, 0, 0, 261, 10, 1], "semantic": {"name": "signature_method", "arg_names": [], "import_names": [], "rhs_call_name": "_get_signature_method", "annotation": ""}, "snippet": " signature_method = self._get_signature_method(oauth_request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L380_C8", "label": "try", "type": "try", "loc": [380, 383], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [7, 2, 0.7294, 0.0076, 2, 0.86, 0.5714, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n signature = oauth_request.get_parameter('oauth_signature')\n except:\n raise OAuthError('Missing signature.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L381_C12", "label": "signature = get_parameter()", "type": "assigned_variable", "loc": [381, 381], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L380_C8", "vector": [14, 3, 0.7285, 0.0019, 3, 0.35, 0.0, 932, 3, 1, 0, 0, 386, 10, 1], "semantic": {"name": "signature", "arg_names": [], "import_names": [], "rhs_call_name": "get_parameter", "annotation": ""}, "snippet": " signature = oauth_request.get_parameter('oauth_signature')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L385_C8", "label": "valid_sig = check_signature()", "type": "assigned_variable", "loc": [385, 385], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [14, 2, 0.7361, 0.0019, 2, 0.86, 0.7143, 108, 3, 4, 0, 0, 862, 10, 1], "semantic": {"name": "valid_sig", "arg_names": [], "import_names": [], "rhs_call_name": "check_signature", "annotation": ""}, "snippet": " valid_sig = signature_method.check_signature(oauth_request, consumer, token, signature)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L386_C8", "label": "if", "type": "if", "loc": [386, 388], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [4, 2, 0.74, 0.0057, 2, 0.86, 0.8571, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not valid_sig:\n key, base = signature_method.build_signature_base_string(oauth_request, consumer, token)\n raise OAuthError('Invalid signature. Expected signature base string: %s' % base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L387_C12", "label": "key, base = build_signature_base_string()", "type": "assigned_variable", "loc": [387, 387], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L386_C8", "vector": [14, 3, 0.74, 0.0019, 3, 0.08, 0.0, 994, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, base", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, base = signature_method.build_signature_base_string(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L389_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [389, 389], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "vector": [14, 2, 0.7438, 0.0019, 2, 0.86, 1.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = signature_method.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "label": "_check_timestamp", "type": "function", "loc": [391, 397], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.7533, 0.0134, 1, 0.43, 0.95, 607, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "_check_timestamp", "arg_names": ["self", "timestamp"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_timestamp(self, timestamp):\n # verify that timestamp is recentish\n timestamp = int(timestamp)\n now = int(time.time())\n lapsed = now - timestamp\n if lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a greater difference than threshold %d' % (timestamp, now, self.timestamp_threshold))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L393_C8", "label": "timestamp = int()", "type": "assigned_variable", "loc": [393, 393], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "vector": [14, 2, 0.7514, 0.0019, 2, 0.77, 0.0, 834, 3, 1, 0, 0, 901, 10, 1], "semantic": {"name": "timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " timestamp = int(timestamp)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L394_C8", "label": "now = int()", "type": "assigned_variable", "loc": [394, 394], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "vector": [14, 2, 0.7533, 0.0019, 2, 0.77, 0.3333, 894, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "now", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " now = int(time.time())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L395_C8", "label": "lapsed =", "type": "assigned_variable", "loc": [395, 395], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "vector": [14, 2, 0.7553, 0.0019, 2, 0.77, 0.6667, 793, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lapsed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lapsed = now - timestamp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L396_C8", "label": "if", "type": "if", "loc": [396, 397], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "vector": [4, 2, 0.7581, 0.0038, 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 lapsed > self.timestamp_threshold:\n raise OAuthError('Expired timestamp: given %d and now %s has a greater difference than threshold %d' % (timestamp, now, self.timestamp_threshold))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4", "label": "_check_nonce", "type": "function", "loc": [399, 403], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "vector": [2, 1, 0.7667, 0.0096, 1, 0.43, 1.0, 731, 0, 4, 0, 0, 0, 0, 3], "semantic": {"name": "_check_nonce", "arg_names": ["self", "consumer", "token", "nonce"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _check_nonce(self, consumer, token, nonce):\n # verify that the nonce is uniqueish\n nonce = self.data_store.lookup_nonce(consumer, token, nonce)\n if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L401_C8", "label": "nonce = lookup_nonce()", "type": "assigned_variable", "loc": [401, 401], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4", "vector": [14, 2, 0.7667, 0.0019, 2, 0.42, 0.0, 116, 3, 3, 0, 0, 379, 10, 1], "semantic": {"name": "nonce", "arg_names": [], "import_names": [], "rhs_call_name": "lookup_nonce", "annotation": ""}, "snippet": " nonce = self.data_store.lookup_nonce(consumer, token, nonce)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L402_C8", "label": "if", "type": "if", "loc": [402, 403], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4", "vector": [4, 2, 0.7696, 0.0038, 2, 0.42, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nonce:\n raise OAuthError('Nonce already used: %s' % str(nonce))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "label": "OAuthClient", "type": "class", "loc": [406, 430], "level": 0, "parent": null, "vector": [3, 0, 0.7992, 0.0478, 0, 0.66, 0.8261, 840, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthClient", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthClient(object):\n consumer = None\n token = None\n\n def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L407_C4", "label": "consumer =", "type": "assigned_variable", "loc": [407, 407], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [14, 1, 0.7782, 0.0019, 1, 0.81, 0.0, 352, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " consumer = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L408_C4", "label": "token =", "type": "assigned_variable", "loc": [408, 408], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [14, 1, 0.7801, 0.0019, 1, 0.81, 0.1429, 129, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " token = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4", "label": "__init__", "type": "function", "loc": [410, 412], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.7859, 0.0057, 1, 0.81, 0.2857, 555, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, oauth_consumer, oauth_token):\n self.consumer = oauth_consumer\n self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L411_C8", "label": "self.consumer =", "type": "assigned_variable", "loc": [411, 411], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4", "vector": [14, 2, 0.7859, 0.0019, 2, 0.05, 0.0, 33, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.consumer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.consumer = oauth_consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L412_C8", "label": "self.token =", "type": "assigned_variable", "loc": [412, 412], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4", "vector": [14, 2, 0.7878, 0.0019, 2, 0.05, 1.0, 150, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.token", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.token = oauth_token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L414_C4", "label": "get_consumer", "type": "function", "loc": [414, 415], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.7925, 0.0038, 1, 0.81, 0.4286, 408, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_consumer", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_consumer(self):\n return self.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L415_C8", "label": "return", "type": "return", "loc": [415, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L414_C4", "vector": [13, 2, 0.7935, 0.0019, 2, 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.consumer"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L417_C4", "label": "get_token", "type": "function", "loc": [417, 418], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.7983, 0.0038, 1, 0.81, 0.5714, 224, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_token", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_token(self):\n return self.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L418_C8", "label": "return", "type": "return", "loc": [418, 418], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L417_C4", "vector": [13, 2, 0.7992, 0.0019, 2, 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.token"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L420_C4", "label": "fetch_request_token", "type": "function", "loc": [420, 422], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.805, 0.0057, 1, 0.81, 0.7143, 255, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_request):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L424_C4", "label": "fetch_access_token", "type": "function", "loc": [424, 426], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.8126, 0.0057, 1, 0.81, 0.8571, 413, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_request):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L428_C4", "label": "access_resource", "type": "function", "loc": [428, 430], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "vector": [2, 1, 0.8203, 0.0057, 1, 0.81, 1.0, 654, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "access_resource", "arg_names": ["self", "oauth_request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def access_resource(self, oauth_request):\n # -> some protected resource\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "label": "OAuthDataStore", "type": "class", "loc": [433, 457], "level": 0, "parent": null, "vector": [3, 0, 0.8509, 0.0478, 0, 0.66, 0.8696, 257, 0, 6, 0, 0, 186, 0, 0], "semantic": {"name": "OAuthDataStore", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthDataStore(object):\n\n def lookup_consumer(self, key):\n # -> OAuthConsumer\n raise NotImplementedError\n\n def lookup_token(self, oauth_consumer, token_type, token_token):\n # -> OAuthToken"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L435_C4", "label": "lookup_consumer", "type": "function", "loc": [435, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8337, 0.0057, 1, 0.96, 0.0, 718, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_consumer", "arg_names": ["self", "key"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_consumer(self, key):\n # -> OAuthConsumer\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L439_C4", "label": "lookup_token", "type": "function", "loc": [439, 441], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8413, 0.0057, 1, 0.96, 0.2, 87, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_token", "arg_names": ["self", "oauth_consumer", "token_type", "token_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_token(self, oauth_consumer, token_type, token_token):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L443_C4", "label": "lookup_nonce", "type": "function", "loc": [443, 445], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8489, 0.0057, 1, 0.96, 0.4, 379, 0, 5, 0, 0, 0, 0, 0], "semantic": {"name": "lookup_nonce", "arg_names": ["self", "oauth_consumer", "oauth_token", "nonce", "timestamp"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def lookup_nonce(self, oauth_consumer, oauth_token, nonce, timestamp):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L447_C4", "label": "fetch_request_token", "type": "function", "loc": [447, 449], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8566, 0.0057, 1, 0.96, 0.6, 255, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_request_token", "arg_names": ["self", "oauth_consumer"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_request_token(self, oauth_consumer):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L451_C4", "label": "fetch_access_token", "type": "function", "loc": [451, 453], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8642, 0.0057, 1, 0.96, 0.8, 413, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "fetch_access_token", "arg_names": ["self", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def fetch_access_token(self, oauth_consumer, oauth_token):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L455_C4", "label": "authorize_request_token", "type": "function", "loc": [455, 457], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "vector": [2, 1, 0.8719, 0.0057, 1, 0.96, 1.0, 879, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "authorize_request_token", "arg_names": ["self", "oauth_token", "user"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def authorize_request_token(self, oauth_token, user):\n # -> OAuthToken\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "label": "OAuthSignatureMethod", "type": "class", "loc": [460, 475], "level": 0, "parent": null, "vector": [3, 0, 0.8939, 0.0306, 0, 0.66, 0.913, 310, 0, 4, 0, 0, 186, 0, 1], "semantic": {"name": "OAuthSignatureMethod", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod(object):\n def get_name(self):\n # -> str\n raise NotImplementedError\n\n def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n # -> str key, str raw\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L461_C4", "label": "get_name", "type": "function", "loc": [461, 463], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "vector": [2, 1, 0.8834, 0.0057, 1, 0.22, 0.0, 770, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n # -> str\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L465_C4", "label": "build_signature_base_string", "type": "function", "loc": [465, 467], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "vector": [2, 1, 0.891, 0.0057, 1, 0.22, 0.3333, 910, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, oauth_consumer, oauth_token):\n # -> str key, str raw\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L469_C4", "label": "build_signature", "type": "function", "loc": [469, 471], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "vector": [2, 1, 0.8987, 0.0057, 1, 0.22, 0.6667, 181, 0, 4, 0, 0, 0, 0, 0], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "oauth_consumer", "oauth_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, oauth_consumer, oauth_token):\n # -> str\n raise NotImplementedError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4", "label": "check_signature", "type": "function", "loc": [473, 475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "vector": [2, 1, 0.9063, 0.0057, 1, 0.22, 1.0, 862, 0, 5, 1, 0, 0, 0, 1], "semantic": {"name": "check_signature", "arg_names": ["self", "oauth_request", "consumer", "token", "signature"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def check_signature(self, oauth_request, consumer, token, signature):\n built = self.build_signature(oauth_request, consumer, token)\n return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L474_C8", "label": "built = build_signature()", "type": "assigned_variable", "loc": [474, 474], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4", "vector": [14, 2, 0.9063, 0.0019, 2, 0.6, 0.0, 135, 3, 3, 0, 0, 181, 10, 1], "semantic": {"name": "built", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature", "annotation": ""}, "snippet": " built = self.build_signature(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L475_C8", "label": "return", "type": "return", "loc": [475, 475], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4", "vector": [13, 2, 0.9082, 0.0019, 2, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return built == signature"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "label": "OAuthSignatureMethod_HMAC_SHA1", "type": "class", "loc": [477, 508], "level": 0, "parent": null, "vector": [3, 0, 0.9417, 0.0612, 0, 0.66, 0.9565, 605, 0, 3, 0, 0, 310, 0, 14], "semantic": {"name": "OAuthSignatureMethod_HMAC_SHA1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_HMAC_SHA1(OAuthSignatureMethod):\n\n def get_name(self):\n return 'HMAC-SHA1'\n \n def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L479_C4", "label": "get_name", "type": "function", "loc": [479, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "vector": [2, 1, 0.9168, 0.0038, 1, 0.41, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L480_C8", "label": "return", "type": "return", "loc": [480, 480], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L479_C4", "vector": [13, 2, 0.9178, 0.0019, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'HMAC-SHA1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "label": "build_signature_base_string", "type": "function", "loc": [482, 493], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "vector": [2, 1, 0.9321, 0.0229, 1, 0.41, 0.5, 910, 0, 4, 1, 0, 0, 0, 9], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )\n\n key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L483_C8", "label": "sig =", "type": "assigned_variable", "loc": [483, 487], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "vector": [14, 2, 0.9273, 0.0096, 2, 0.55, 0.0, 899, 0, 0, 0, 0, 0, 8, 6], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = (\n escape(oauth_request.get_normalized_http_method()),\n escape(oauth_request.get_normalized_http_url()),\n escape(oauth_request.get_normalized_parameters()),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L489_C8", "label": "key =", "type": "assigned_variable", "loc": [489, 489], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "vector": [14, 2, 0.935, 0.0019, 2, 0.55, 0.25, 230, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " key = '%s&' % escape(consumer.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L490_C8", "label": "if", "type": "if", "loc": [490, 491], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "vector": [4, 2, 0.9379, 0.0038, 2, 0.55, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n key += escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L492_C8", "label": "raw = join()", "type": "assigned_variable", "loc": [492, 492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "vector": [14, 2, 0.9407, 0.0019, 2, 0.55, 0.75, 23, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "raw", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " raw = '&'.join(sig)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L493_C8", "label": "return", "type": "return", "loc": [493, 493], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "vector": [13, 2, 0.9426, 0.0019, 2, 0.55, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return key, raw"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "label": "build_signature", "type": "function", "loc": [495, 508], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "vector": [2, 1, 0.9589, 0.0268, 1, 0.41, 1.0, 181, 0, 4, 1, 0, 0, 0, 5], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n # build the base signature string\n key, raw = self.build_signature_base_string(oauth_request, consumer, token)\n\n # hmac object\n try:\n import hashlib # 2.5\n hashed = hmac.new(key, raw, hashlib.sha1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L497_C8", "label": "key, raw = build_signature_base_string()", "type": "assigned_variable", "loc": [497, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "vector": [14, 2, 0.9503, 0.0019, 2, 0.5, 0.0, 864, 3, 3, 0, 0, 910, 10, 1], "semantic": {"name": "key, raw", "arg_names": [], "import_names": [], "rhs_call_name": "build_signature_base_string", "annotation": ""}, "snippet": " key, raw = self.build_signature_base_string(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "label": "try", "type": "try", "loc": [500, 505], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "vector": [7, 2, 0.9608, 0.0115, 2, 0.5, 0.5, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n import hashlib # 2.5\n hashed = hmac.new(key, raw, hashlib.sha1)\n except:\n import sha # deprecated\n hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L501_C12", "label": "hashlib import hashlib", "type": "import", "loc": [501, 501], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "vector": [1, 3, 0.9579, 0.0019, 3, 0.87, 0.0, 154, 0, 1, 0, 0, 154, 0, 0], "semantic": {"name": "hashlib", "arg_names": [], "import_names": ["hashlib"], "rhs_call_name": "", "annotation": ""}, "snippet": " import hashlib # 2.5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L502_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [502, 502], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "vector": [14, 3, 0.9598, 0.0019, 3, 0.87, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, hashlib.sha1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L504_C12", "label": "sha import sha", "type": "import", "loc": [504, 504], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "vector": [1, 3, 0.9637, 0.0019, 3, 0.87, 0.0, 263, 0, 1, 0, 0, 263, 0, 0], "semantic": {"name": "sha", "arg_names": [], "import_names": ["sha"], "rhs_call_name": "", "annotation": ""}, "snippet": " import sha # deprecated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L505_C12", "label": "hashed = new()", "type": "assigned_variable", "loc": [505, 505], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "vector": [14, 3, 0.9656, 0.0019, 3, 0.87, 1.0, 942, 3, 3, 0, 0, 145, 10, 1], "semantic": {"name": "hashed", "arg_names": [], "import_names": [], "rhs_call_name": "new", "annotation": ""}, "snippet": " hashed = hmac.new(key, raw, sha)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L508_C8", "label": "return", "type": "return", "loc": [508, 508], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "vector": [13, 2, 0.9713, 0.0019, 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 base64.b64encode(hashed.digest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "label": "OAuthSignatureMethod_PLAINTEXT", "type": "class", "loc": [510, 523], "level": 0, "parent": null, "vector": [3, 0, 0.9876, 0.0268, 0, 0.66, 1.0, 935, 0, 3, 0, 0, 310, 0, 3], "semantic": {"name": "OAuthSignatureMethod_PLAINTEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OAuthSignatureMethod_PLAINTEXT(OAuthSignatureMethod):\n\n def get_name(self):\n return 'PLAINTEXT'\n\n def build_signature_base_string(self, oauth_request, consumer, token):\n # concatenate the consumer key and secret\n sig = escape(consumer.secret) + '&'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L512_C4", "label": "get_name", "type": "function", "loc": [512, 513], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "vector": [2, 1, 0.9799, 0.0038, 1, 0.11, 0.0, 770, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "get_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_name(self):\n return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L513_C8", "label": "return", "type": "return", "loc": [513, 513], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L512_C4", "vector": [13, 2, 0.9809, 0.0019, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'PLAINTEXT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "label": "build_signature_base_string", "type": "function", "loc": [515, 520], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "vector": [2, 1, 0.9895, 0.0115, 1, 0.11, 0.5, 910, 0, 4, 1, 0, 0, 0, 2], "semantic": {"name": "build_signature_base_string", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature_base_string(self, oauth_request, consumer, token):\n # concatenate the consumer key and secret\n sig = escape(consumer.secret) + '&'\n if token:\n sig = sig + escape(token.secret)\n return sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L517_C8", "label": "sig =", "type": "assigned_variable", "loc": [517, 517], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "vector": [14, 2, 0.9885, 0.0019, 2, 0.67, 0.0, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = escape(consumer.secret) + '&'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L518_C8", "label": "if", "type": "if", "loc": [518, 519], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "vector": [4, 2, 0.9914, 0.0038, 2, 0.67, 0.5, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if token:\n sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L519_C12", "label": "sig =", "type": "assigned_variable", "loc": [519, 519], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L518_C8", "vector": [14, 3, 0.9924, 0.0019, 3, 0.42, 0.0, 899, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sig", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " sig = sig + escape(token.secret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L520_C8", "label": "return", "type": "return", "loc": [520, 520], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "vector": [13, 2, 0.9943, 0.0019, 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 sig"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L522_C4", "label": "build_signature", "type": "function", "loc": [522, 523], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "vector": [2, 1, 0.999, 0.0038, 1, 0.11, 1.0, 181, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "build_signature", "arg_names": ["self", "oauth_request", "consumer", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def build_signature(self, oauth_request, consumer, token):\n return self.build_signature_base_string(oauth_request, consumer, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L523_C8", "label": "return", "type": "return", "loc": [523, 523], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L522_C4", "vector": [13, 2, 1.0, 0.0019, 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 self.build_signature_base_string(oauth_request, consumer, token)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L16_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L19_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L34_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L39_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L44_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L43_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L45_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L60_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L69_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L70_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L71_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L68_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L72_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L74_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L75_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L96_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L97_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L95_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L100_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L101_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L103_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L104_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L104_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L105_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L109_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L110_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L114_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L115_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L115_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L117_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L117_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L118_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L119_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L123_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L125_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L125_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L126_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L122_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L128_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L131_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L131_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L132_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L135_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L140_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L141_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L148_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L139_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L153_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L154_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L158_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L157_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L160_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L163_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L169_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L171_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L176_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L177_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L181_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L180_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L183_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L183_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L186_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L184_C16", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L187_C20"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L193_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L192_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L194_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L198_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L199_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L201_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L201_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L202_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L174_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L208_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L208_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L209_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L211_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L218_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L219_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L221_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L221_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L222_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L207_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L224_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L228_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L228_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L229_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L231_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L233_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L233_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L234_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L227_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L236_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L242_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L245_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L248_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L250_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L243_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L252_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L240_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L253_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L259_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:For_L259_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L260_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L257_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L261_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L265_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L266_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L267_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L271_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L270_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L272_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L274_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L274_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L275_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L277_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L277_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L278_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L281_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L280_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L282_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L289_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L292_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L293_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L294_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L287_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L296_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L286_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L297_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L302_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L303_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L305_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L306_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L307_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L301_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L308_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L313_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L314_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L316_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L317_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L318_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L311_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L319_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L322_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L322_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L323_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L326_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L327_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L330_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L330_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L331_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L336_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L335_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L338_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L339_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L334_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L341_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L346_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L345_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L348_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L351_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L349_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L353_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L344_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L356_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L359_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L360_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L362_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L363_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L358_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L365_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L369_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L370_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L371_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L368_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L373_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L376_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L377_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Expr_L378_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L379_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L380_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L380_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L381_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L385_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L386_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L386_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L387_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L375_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L389_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L394_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L395_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L391_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L396_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L264_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L399_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L402_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L407_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L408_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L411_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L410_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L412_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L417_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L417_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L418_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L420_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L424_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L406_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L428_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L435_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L439_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L447_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L451_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L433_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L455_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L461_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L465_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L469_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L460_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L474_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L473_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L475_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L479_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L479_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L480_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L483_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L489_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L490_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L492_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L482_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L493_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L477_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L497_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L501_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L502_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Import_L504_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:Try_L500_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L505_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L495_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L512_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L512_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L517_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L518_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:If_L518_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Assign_L519_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L515_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L520_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:ClassDef_L510_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L522_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1152:FunctionDef_L522_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1152:Return_L523_C8"}] |
#!/usr/bin/python2.4
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Unit tests for the wavelet module."""
import unittest
import blip
import element
import ops
import wavelet
import simplejson
ROBOT_NAME = 'robot@appspot.com'
TEST_WAVELET_DATA = {
'creator': ROBOT_NAME,
'creationTime': 100,
'lastModifiedTime': 101,
'participants': [ROBOT_NAME],
'participantsRoles': {ROBOT_NAME: wavelet.Participants.ROLE_FULL},
'rootBlipId': 'blip-1',
'title': 'Title',
'waveId': 'test.com!w+g3h3im',
'waveletId': 'test.com!root+conv',
'tags': ['tag1', 'tag2'],
}
TEST_BLIP_DATA = {
'blipId': TEST_WAVELET_DATA['rootBlipId'],
'childBlipIds': [],
'content': '\ntesting',
'contributors': [TEST_WAVELET_DATA['creator'], 'robot@google.com'],
'creator': TEST_WAVELET_DATA['creator'],
'lastModifiedTime': TEST_WAVELET_DATA['lastModifiedTime'],
'parentBlipId': None,
'waveId': TEST_WAVELET_DATA['waveId'],
'elements': {},
'waveletId': TEST_WAVELET_DATA['waveletId'],
}
class TestWavelet(unittest.TestCase):
"""Tests the wavelet class."""
def setUp(self):
self.operation_queue = ops.OperationQueue()
self.all_blips = {}
self.blip = blip.Blip(TEST_BLIP_DATA,
self.all_blips,
self.operation_queue)
self.all_blips[self.blip.blip_id] = self.blip
self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,
self.all_blips,
None,
self.operation_queue)
self.wavelet.robot_address = ROBOT_NAME
def testWaveletProperties(self):
w = self.wavelet
self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)
self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)
self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],
w.last_modified_time)
self.assertEquals(len(TEST_WAVELET_DATA['participants']),
len(w.participants))
self.assertTrue(TEST_WAVELET_DATA['participants'][0] in w.participants)
self.assertEquals(TEST_WAVELET_DATA['rootBlipId'], w.root_blip.blip_id)
self.assertEquals(TEST_WAVELET_DATA['title'], w.title)
self.assertEquals(TEST_WAVELET_DATA['waveId'], w.wave_id)
self.assertEquals(TEST_WAVELET_DATA['waveletId'], w.wavelet_id)
self.assertEquals('test.com', w.domain)
def testWaveletMethods(self):
w = self.wavelet
reply = w.reply()
self.assertEquals(2, len(w.blips))
w.delete(reply)
self.assertEquals(1, len(w.blips))
self.assertEquals(0, len(w.data_documents))
self.wavelet.data_documents['key'] = 'value'
self.assert_('key' in w.data_documents)
self.assertEquals(1, len(w.data_documents))
for key in w.data_documents:
self.assertEquals(key, 'key')
self.assertEquals(1, len(w.data_documents.keys()))
self.wavelet.data_documents['key'] = None
self.assertEquals(0, len(w.data_documents))
num_participants = len(w.participants)
w.proxy_for('proxy').reply()
self.assertEquals(2, len(w.blips))
# check that the new proxy for participant was added
self.assertEquals(num_participants + 1, len(w.participants))
w._robot_address = ROBOT_NAME.replace('@', '+proxy@')
w.proxy_for('proxy').reply()
self.assertEquals(num_participants + 1, len(w.participants))
self.assertEquals(3, len(w.blips))
def testSetTitle(self):
self.blip._content = '\nOld title\n\nContent'
self.wavelet.title = 'New title \xd0\xb0\xd0\xb1\xd0\xb2'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals(u'\nNew title \u0430\u0431\u0432\n\nContent',
self.blip._content)
def testSetTitleAdjustRootBlipWithOneLineProperly(self):
self.blip._content = '\nOld title'
self.wavelet.title = 'New title'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals('\nNew title\n', self.blip._content)
def testSetTitleAdjustEmptyRootBlipProperly(self):
self.blip._content = '\n'
self.wavelet.title = 'New title'
self.assertEquals(1, len(self.operation_queue))
self.assertEquals('wavelet.setTitle',
self.operation_queue.serialize()[1]['method'])
self.assertEquals('\nNew title\n', self.blip._content)
def testTags(self):
w = self.wavelet
self.assertEquals(2, len(w.tags))
w.tags.append('tag3')
self.assertEquals(3, len(w.tags))
w.tags.append('tag3')
self.assertEquals(3, len(w.tags))
w.tags.remove('tag1')
self.assertEquals(2, len(w.tags))
self.assertEquals('tag2', w.tags[0])
def testParticipantRoles(self):
w = self.wavelet
self.assertEquals(wavelet.Participants.ROLE_FULL,
w.participants.get_role(ROBOT_NAME))
w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)
self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,
w.participants.get_role(ROBOT_NAME))
def testSerialize(self):
self.blip.append(element.Gadget('http://test.com', {'a': 3}))
self.wavelet.title = 'A wavelet title'
self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',
width=320, height=118))
self.blip.append(element.Attachment(caption='fake', data='fake data'))
self.blip.append(element.Line(line_type='li', indent='2'))
self.blip.append('bulleted!')
self.blip.append(element.Installer(
'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml'))
self.wavelet.proxy_for('proxy').reply().append('hi from douwe')
inlineBlip = self.blip.insert_inline_blip(5)
inlineBlip.append('hello again!')
serialized = self.wavelet.serialize()
serialized = simplejson.dumps(serialized)
self.assertTrue(serialized.find('test.com') > 0)
if __name__ == '__main__':
unittest.main()
| ajibawa-2023/Python-Code-Large/train/row_1153 | 103 | 177 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.096, 0.0056, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Unit tests for the wavelet module.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L20_C0", "label": "unittest import unittest", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.113, 0.0056, 0, 0.66, 0.0909, 88, 0, 1, 0, 0, 88, 0, 0], "semantic": {"name": "unittest", "arg_names": [], "import_names": ["unittest"], "rhs_call_name": "", "annotation": ""}, "snippet": "import unittest"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L22_C0", "label": "blip import blip", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1243, 0.0056, 0, 0.66, 0.1818, 134, 0, 1, 0, 0, 134, 0, 0], "semantic": {"name": "blip", "arg_names": [], "import_names": ["blip"], "rhs_call_name": "", "annotation": ""}, "snippet": "import blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L23_C0", "label": "element import element", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1299, 0.0056, 0, 0.66, 0.2727, 736, 0, 1, 0, 0, 736, 0, 0], "semantic": {"name": "element", "arg_names": [], "import_names": ["element"], "rhs_call_name": "", "annotation": ""}, "snippet": "import element"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L24_C0", "label": "ops import ops", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.1356, 0.0056, 0, 0.66, 0.3636, 212, 0, 1, 0, 0, 212, 0, 0], "semantic": {"name": "ops", "arg_names": [], "import_names": ["ops"], "rhs_call_name": "", "annotation": ""}, "snippet": "import ops"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L25_C0", "label": "wavelet import wavelet", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.1412, 0.0056, 0, 0.66, 0.4545, 147, 0, 1, 0, 0, 147, 0, 0], "semantic": {"name": "wavelet", "arg_names": [], "import_names": ["wavelet"], "rhs_call_name": "", "annotation": ""}, "snippet": "import wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Import_L27_C0", "label": "simplejson import simplejson", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.1525, 0.0056, 0, 0.66, 0.5455, 386, 0, 1, 0, 0, 386, 0, 0], "semantic": {"name": "simplejson", "arg_names": [], "import_names": ["simplejson"], "rhs_call_name": "", "annotation": ""}, "snippet": "import simplejson"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L29_C0", "label": "ROBOT_NAME =", "type": "assigned_variable", "loc": [29, 29], "level": 0, "parent": null, "vector": [14, 0, 0.1638, 0.0056, 0, 0.66, 0.6364, 987, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROBOT_NAME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROBOT_NAME = 'robot@appspot.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L31_C0", "label": "TEST_WAVELET_DATA =", "type": "assigned_variable", "loc": [31, 42], "level": 0, "parent": null, "vector": [14, 0, 0.2062, 0.0678, 0, 0.66, 0.7273, 552, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_WAVELET_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_WAVELET_DATA = {\n 'creator': ROBOT_NAME,\n 'creationTime': 100,\n 'lastModifiedTime': 101,\n 'participants': [ROBOT_NAME],\n 'participantsRoles': {ROBOT_NAME: wavelet.Participants.ROLE_FULL},\n 'rootBlipId': 'blip-1',\n 'title': 'Title',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L44_C0", "label": "TEST_BLIP_DATA =", "type": "assigned_variable", "loc": [44, 55], "level": 0, "parent": null, "vector": [14, 0, 0.2797, 0.0678, 0, 0.66, 0.8182, 853, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "TEST_BLIP_DATA", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEST_BLIP_DATA = {\n 'blipId': TEST_WAVELET_DATA['rootBlipId'],\n 'childBlipIds': [],\n 'content': '\\ntesting',\n 'contributors': [TEST_WAVELET_DATA['creator'], 'robot@google.com'],\n 'creator': TEST_WAVELET_DATA['creator'],\n 'lastModifiedTime': TEST_WAVELET_DATA['lastModifiedTime'],\n 'parentBlipId': None,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "label": "TestWavelet", "type": "class", "loc": [58, 174], "level": 0, "parent": null, "vector": [3, 0, 0.6554, 0.661, 0, 0.66, 0.9091, 610, 0, 9, 0, 0, 878, 0, 98], "semantic": {"name": "TestWavelet", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestWavelet(unittest.TestCase):\n \"\"\"Tests the wavelet class.\"\"\"\n\n def setUp(self):\n self.operation_queue = ops.OperationQueue()\n self.all_blips = {}\n self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L59_C2", "label": "expression", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [8, 1, 0.3333, 0.0056, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tests the wavelet class.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "label": "setUp", "type": "function", "loc": [61, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.3757, 0.0678, 1, 0.11, 0.1111, 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 self.operation_queue = ops.OperationQueue()\n self.all_blips = {}\n self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,\n self.operation_queue)\n self.all_blips[self.blip.blip_id] = self.blip\n self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L62_C4", "label": "self.operation_queue = OperationQueue()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.3503, 0.0056, 2, 0.66, 0.0, 118, 3, 0, 0, 0, 786, 10, 1], "semantic": {"name": "self.operation_queue", "arg_names": [], "import_names": [], "rhs_call_name": "OperationQueue", "annotation": ""}, "snippet": " self.operation_queue = ops.OperationQueue()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L63_C4", "label": "self.all_blips =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.3559, 0.0056, 2, 0.66, 0.2, 606, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self.all_blips", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L64_C4", "label": "self.blip = Blip()", "type": "assigned_variable", "loc": [64, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.3672, 0.0169, 2, 0.66, 0.4, 949, 3, 3, 0, 0, 762, 10, 1], "semantic": {"name": "self.blip", "arg_names": [], "import_names": [], "rhs_call_name": "Blip", "annotation": ""}, "snippet": " self.blip = blip.Blip(TEST_BLIP_DATA,\n self.all_blips,\n self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L67_C4", "label": "assign", "type": "assigned_variable", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.3785, 0.0056, 2, 0.66, 0.6, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.all_blips[self.blip.blip_id] = self.blip"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L68_C4", "label": "self.wavelet = Wavelet()", "type": "assigned_variable", "loc": [68, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.3927, 0.0226, 2, 0.66, 0.8, 288, 3, 4, 0, 0, 108, 10, 1], "semantic": {"name": "self.wavelet", "arg_names": [], "import_names": [], "rhs_call_name": "Wavelet", "annotation": ""}, "snippet": " self.wavelet = wavelet.Wavelet(TEST_WAVELET_DATA,\n self.all_blips,\n None,\n self.operation_queue)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L72_C4", "label": "self.wavelet.robot_address =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "vector": [14, 2, 0.4068, 0.0056, 2, 0.66, 1.0, 641, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.wavelet.robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.robot_address = ROBOT_NAME"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "label": "testWaveletProperties", "type": "function", "loc": [74, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.4548, 0.0791, 1, 0.11, 0.2222, 17, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testWaveletProperties", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWaveletProperties(self):\n w = self.wavelet\n self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)\n self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)\n self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],\n w.last_modified_time)\n self.assertEquals(len(TEST_WAVELET_DATA['participants']),\n len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L75_C4", "label": "w =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [14, 2, 0.4237, 0.0056, 2, 0.22, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L76_C4", "label": "assertEquals()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4294, 0.0056, 2, 0.22, 0.1, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['creator'], w.creator)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L77_C4", "label": "assertEquals()", "type": "expression", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.435, 0.0056, 2, 0.22, 0.2, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['creationTime'], w.creation_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L78_C4", "label": "assertEquals()", "type": "expression", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4435, 0.0113, 2, 0.22, 0.3, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['lastModifiedTime'],\n w.last_modified_time)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L80_C4", "label": "assertEquals()", "type": "expression", "loc": [80, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4548, 0.0113, 2, 0.22, 0.4, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(len(TEST_WAVELET_DATA['participants']),\n len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L82_C4", "label": "assertTrue()", "type": "expression", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4633, 0.0056, 2, 0.22, 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(TEST_WAVELET_DATA['participants'][0] in w.participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L83_C4", "label": "assertEquals()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4689, 0.0056, 2, 0.22, 0.6, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['rootBlipId'], w.root_blip.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L84_C4", "label": "assertEquals()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4746, 0.0056, 2, 0.22, 0.7, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['title'], w.title)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L85_C4", "label": "assertEquals()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4802, 0.0056, 2, 0.22, 0.8, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['waveId'], w.wave_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L86_C4", "label": "assertEquals()", "type": "expression", "loc": [86, 86], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4859, 0.0056, 2, 0.22, 0.9, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(TEST_WAVELET_DATA['waveletId'], w.wavelet_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L87_C4", "label": "assertEquals()", "type": "expression", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "vector": [8, 2, 0.4915, 0.0056, 2, 0.22, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('test.com', w.domain)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "label": "testWaveletMethods", "type": "function", "loc": [89, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.5678, 0.1356, 1, 0.11, 0.3333, 823, 0, 1, 0, 0, 0, 0, 31], "semantic": {"name": "testWaveletMethods", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testWaveletMethods(self):\n w = self.wavelet\n reply = w.reply()\n self.assertEquals(2, len(w.blips))\n w.delete(reply)\n self.assertEquals(1, len(w.blips))\n self.assertEquals(0, len(w.data_documents))\n self.wavelet.data_documents['key'] = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L90_C4", "label": "w =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.5085, 0.0056, 2, 0.88, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L91_C4", "label": "reply = reply()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.5141, 0.0056, 2, 0.88, 0.05, 714, 3, 0, 0, 0, 714, 10, 1], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " reply = w.reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L92_C4", "label": "assertEquals()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5198, 0.0056, 2, 0.88, 0.1, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L93_C4", "label": "delete()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5254, 0.0056, 2, 0.88, 0.15, 266, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "delete", "arg_names": [], "import_names": [], "rhs_call_name": "delete", "annotation": ""}, "snippet": " w.delete(reply)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L94_C4", "label": "assertEquals()", "type": "expression", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5311, 0.0056, 2, 0.88, 0.2, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L95_C4", "label": "assertEquals()", "type": "expression", "loc": [95, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5367, 0.0056, 2, 0.88, 0.25, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L96_C4", "label": "assign", "type": "assigned_variable", "loc": [96, 96], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.5424, 0.0056, 2, 0.88, 0.3, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.data_documents['key'] = 'value'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L97_C4", "label": "assert_()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.548, 0.0056, 2, 0.88, 0.35, 17, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "assert_", "arg_names": [], "import_names": [], "rhs_call_name": "assert_", "annotation": ""}, "snippet": " self.assert_('key' in w.data_documents)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L98_C4", "label": "assertEquals()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5537, 0.0056, 2, 0.88, 0.4, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:For_L99_C4", "label": "for key", "type": "for", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [6, 2, 0.5621, 0.0113, 2, 0.88, 0.45, 230, 7, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in w.data_documents:\n self.assertEquals(key, 'key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L100_C6", "label": "assertEquals()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:For_L99_C4", "vector": [8, 3, 0.565, 0.0056, 3, 0.41, 0.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(key, 'key')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L101_C4", "label": "assertEquals()", "type": "expression", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5706, 0.0056, 2, 0.88, 0.5, 60, 3, 2, 0, 0, 0, 0, 3], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(w.data_documents.keys()))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L102_C4", "label": "assign", "type": "assigned_variable", "loc": [102, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.5763, 0.0056, 2, 0.88, 0.55, 0, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.data_documents['key'] = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L103_C4", "label": "assertEquals()", "type": "expression", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5819, 0.0056, 2, 0.88, 0.6, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(0, len(w.data_documents))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L104_C4", "label": "num_participants = len()", "type": "assigned_variable", "loc": [104, 104], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.5876, 0.0056, 2, 0.88, 0.65, 484, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "num_participants", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " num_participants = len(w.participants)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L105_C4", "label": "reply()", "type": "expression", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5932, 0.0056, 2, 0.88, 0.7, 714, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " w.proxy_for('proxy').reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L106_C4", "label": "assertEquals()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.5989, 0.0056, 2, 0.88, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L108_C4", "label": "assertEquals()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.6102, 0.0056, 2, 0.88, 0.8, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(num_participants + 1, len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L109_C4", "label": "w._robot_address = replace()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [14, 2, 0.6158, 0.0056, 2, 0.88, 0.85, 415, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "w._robot_address", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " w._robot_address = ROBOT_NAME.replace('@', '+proxy@')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L110_C4", "label": "reply()", "type": "expression", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.6215, 0.0056, 2, 0.88, 0.9, 714, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "reply", "arg_names": [], "import_names": [], "rhs_call_name": "reply", "annotation": ""}, "snippet": " w.proxy_for('proxy').reply()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L111_C4", "label": "assertEquals()", "type": "expression", "loc": [111, 111], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.6271, 0.0056, 2, 0.88, 0.95, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(num_participants + 1, len(w.participants))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L112_C4", "label": "assertEquals()", "type": "expression", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "vector": [8, 2, 0.6328, 0.0056, 2, 0.88, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.blips))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "label": "testSetTitle", "type": "function", "loc": [114, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.6638, 0.0452, 1, 0.11, 0.4444, 813, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitle", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitle(self):\n self.blip._content = '\\nOld title\\n\\nContent'\n self.wavelet.title = 'New title \\xd0\\xb0\\xd0\\xb1\\xd0\\xb2'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals(u'\\nNew title \\u0430\\u0431\\u0432\\n\\nContent',\n self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L115_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [115, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "vector": [14, 2, 0.6497, 0.0056, 2, 0.54, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\nOld title\\n\\nContent'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L116_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "vector": [14, 2, 0.6554, 0.0056, 2, 0.54, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title \\xd0\\xb0\\xd0\\xb1\\xd0\\xb2'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L117_C4", "label": "assertEquals()", "type": "expression", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "vector": [8, 2, 0.661, 0.0056, 2, 0.54, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L118_C4", "label": "assertEquals()", "type": "expression", "loc": [118, 119], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "vector": [8, 2, 0.6695, 0.0113, 2, 0.54, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L120_C4", "label": "assertEquals()", "type": "expression", "loc": [120, 121], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "vector": [8, 2, 0.6808, 0.0113, 2, 0.54, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(u'\\nNew title \\u0430\\u0431\\u0432\\n\\nContent',\n self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "label": "testSetTitleAdjustRootBlipWithOneLineProperly", "type": "function", "loc": [123, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.7119, 0.0395, 1, 0.11, 0.5556, 4, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitleAdjustRootBlipWithOneLineProperly", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitleAdjustRootBlipWithOneLineProperly(self):\n self.blip._content = '\\nOld title'\n self.wavelet.title = 'New title'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L124_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "vector": [14, 2, 0.7006, 0.0056, 2, 0.82, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\nOld title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L125_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "vector": [14, 2, 0.7062, 0.0056, 2, 0.82, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L126_C4", "label": "assertEquals()", "type": "expression", "loc": [126, 126], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "vector": [8, 2, 0.7119, 0.0056, 2, 0.82, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L127_C4", "label": "assertEquals()", "type": "expression", "loc": [127, 128], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "vector": [8, 2, 0.7203, 0.0113, 2, 0.82, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L129_C4", "label": "assertEquals()", "type": "expression", "loc": [129, 129], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "vector": [8, 2, 0.7288, 0.0056, 2, 0.82, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "label": "testSetTitleAdjustEmptyRootBlipProperly", "type": "function", "loc": [131, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.7571, 0.0395, 1, 0.11, 0.6667, 395, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testSetTitleAdjustEmptyRootBlipProperly", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSetTitleAdjustEmptyRootBlipProperly(self):\n self.blip._content = '\\n'\n self.wavelet.title = 'New title'\n self.assertEquals(1, len(self.operation_queue))\n self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])\n self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L132_C4", "label": "self.blip._content =", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "vector": [14, 2, 0.7458, 0.0056, 2, 0.22, 0.0, 420, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.blip._content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.blip._content = '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L133_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [133, 133], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "vector": [14, 2, 0.7514, 0.0056, 2, 0.22, 0.25, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'New title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L134_C4", "label": "assertEquals()", "type": "expression", "loc": [134, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "vector": [8, 2, 0.7571, 0.0056, 2, 0.22, 0.5, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(1, len(self.operation_queue))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L135_C4", "label": "assertEquals()", "type": "expression", "loc": [135, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "vector": [8, 2, 0.7655, 0.0113, 2, 0.22, 0.75, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('wavelet.setTitle',\n self.operation_queue.serialize()[1]['method'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L137_C4", "label": "assertEquals()", "type": "expression", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "vector": [8, 2, 0.774, 0.0056, 2, 0.22, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('\\nNew title\\n', self.blip._content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "label": "testTags", "type": "function", "loc": [139, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.8107, 0.0565, 1, 0.11, 0.7778, 240, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "testTags", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testTags(self):\n w = self.wavelet\n self.assertEquals(2, len(w.tags))\n w.tags.append('tag3')\n self.assertEquals(3, len(w.tags))\n w.tags.append('tag3')\n self.assertEquals(3, len(w.tags))\n w.tags.remove('tag1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L140_C4", "label": "w =", "type": "assigned_variable", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [14, 2, 0.791, 0.0056, 2, 0.47, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L141_C4", "label": "assertEquals()", "type": "expression", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.7966, 0.0056, 2, 0.47, 0.125, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L142_C4", "label": "append()", "type": "expression", "loc": [142, 142], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8023, 0.0056, 2, 0.47, 0.25, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " w.tags.append('tag3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L143_C4", "label": "assertEquals()", "type": "expression", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8079, 0.0056, 2, 0.47, 0.375, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L144_C4", "label": "append()", "type": "expression", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8136, 0.0056, 2, 0.47, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " w.tags.append('tag3')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L145_C4", "label": "assertEquals()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8192, 0.0056, 2, 0.47, 0.625, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(3, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L146_C4", "label": "remove()", "type": "expression", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8249, 0.0056, 2, 0.47, 0.75, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " w.tags.remove('tag1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L147_C4", "label": "assertEquals()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8305, 0.0056, 2, 0.47, 0.875, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(2, len(w.tags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L148_C4", "label": "assertEquals()", "type": "expression", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "vector": [8, 2, 0.8362, 0.0056, 2, 0.47, 1.0, 60, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals('tag2', w.tags[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "label": "testParticipantRoles", "type": "function", "loc": [150, 156], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.8644, 0.0395, 1, 0.11, 0.8889, 766, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "testParticipantRoles", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testParticipantRoles(self):\n w = self.wavelet\n self.assertEquals(wavelet.Participants.ROLE_FULL,\n w.participants.get_role(ROBOT_NAME))\n w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)\n self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L151_C4", "label": "w =", "type": "assigned_variable", "loc": [151, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "vector": [14, 2, 0.8531, 0.0056, 2, 0.59, 0.0, 549, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " w = self.wavelet"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L152_C4", "label": "assertEquals()", "type": "expression", "loc": [152, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "vector": [8, 2, 0.8616, 0.0113, 2, 0.59, 0.3333, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.Participants.ROLE_FULL,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L154_C4", "label": "set_role()", "type": "expression", "loc": [154, 154], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "vector": [8, 2, 0.8701, 0.0056, 2, 0.59, 0.6667, 497, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "set_role", "arg_names": [], "import_names": [], "rhs_call_name": "set_role", "annotation": ""}, "snippet": " w.participants.set_role(ROBOT_NAME, wavelet.Participants.ROLE_READ_ONLY)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L155_C4", "label": "assertEquals()", "type": "expression", "loc": [155, 156], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "vector": [8, 2, 0.8785, 0.0113, 2, 0.59, 1.0, 60, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "assertEquals", "arg_names": [], "import_names": [], "rhs_call_name": "assertEquals", "annotation": ""}, "snippet": " self.assertEquals(wavelet.Participants.ROLE_READ_ONLY,\n w.participants.get_role(ROBOT_NAME))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "label": "testSerialize", "type": "function", "loc": [158, 174], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "vector": [2, 1, 0.9379, 0.096, 1, 0.11, 1.0, 465, 0, 1, 0, 0, 0, 0, 20], "semantic": {"name": "testSerialize", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def testSerialize(self):\n self.blip.append(element.Gadget('http://test.com', {'a': 3}))\n self.wavelet.title = 'A wavelet title'\n self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',\n width=320, height=118))\n self.blip.append(element.Attachment(caption='fake', data='fake data'))\n self.blip.append(element.Line(line_type='li', indent='2'))\n self.blip.append('bulleted!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L159_C4", "label": "append()", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.8983, 0.0056, 2, 0.41, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Gadget('http://test.com', {'a': 3}))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L160_C4", "label": "self.wavelet.title =", "type": "assigned_variable", "loc": [160, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [14, 2, 0.904, 0.0056, 2, 0.41, 0.0833, 586, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self.wavelet.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.wavelet.title = 'A wavelet title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L161_C4", "label": "append()", "type": "expression", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9124, 0.0113, 2, 0.41, 0.1667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Image(url='http://www.google.com/logos/clickortreat1.gif',\n width=320, height=118))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L163_C4", "label": "append()", "type": "expression", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9209, 0.0056, 2, 0.41, 0.25, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Attachment(caption='fake', data='fake data'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L164_C4", "label": "append()", "type": "expression", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9266, 0.0056, 2, 0.41, 0.3333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Line(line_type='li', indent='2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L165_C4", "label": "append()", "type": "expression", "loc": [165, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9322, 0.0056, 2, 0.41, 0.4167, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append('bulleted!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L166_C4", "label": "append()", "type": "expression", "loc": [166, 167], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9407, 0.0113, 2, 0.41, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.blip.append(element.Installer(\n 'http://wave-skynet.appspot.com/public/extensions/areyouin/manifest.xml'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L168_C4", "label": "append()", "type": "expression", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9492, 0.0056, 2, 0.41, 0.5833, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " self.wavelet.proxy_for('proxy').reply().append('hi from douwe')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L169_C4", "label": "inlineBlip = insert_inline_blip()", "type": "assigned_variable", "loc": [169, 169], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [14, 2, 0.9548, 0.0056, 2, 0.41, 0.6667, 489, 3, 1, 0, 0, 203, 10, 1], "semantic": {"name": "inlineBlip", "arg_names": [], "import_names": [], "rhs_call_name": "insert_inline_blip", "annotation": ""}, "snippet": " inlineBlip = self.blip.insert_inline_blip(5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L170_C4", "label": "append()", "type": "expression", "loc": [170, 170], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9605, 0.0056, 2, 0.41, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " inlineBlip.append('hello again!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L172_C4", "label": "serialized = serialize()", "type": "assigned_variable", "loc": [172, 172], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [14, 2, 0.9718, 0.0056, 2, 0.41, 0.8333, 280, 3, 0, 0, 0, 50, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "serialize", "annotation": ""}, "snippet": " serialized = self.wavelet.serialize()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L173_C4", "label": "serialized = dumps()", "type": "assigned_variable", "loc": [173, 173], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [14, 2, 0.9774, 0.0056, 2, 0.41, 0.9167, 280, 3, 1, 0, 0, 160, 10, 1], "semantic": {"name": "serialized", "arg_names": [], "import_names": [], "rhs_call_name": "dumps", "annotation": ""}, "snippet": " serialized = simplejson.dumps(serialized)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L174_C4", "label": "assertTrue()", "type": "expression", "loc": [174, 174], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "vector": [8, 2, 0.9831, 0.0056, 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(serialized.find('test.com') > 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:If_L176_C0", "label": "if", "type": "if", "loc": [176, 177], "level": 0, "parent": null, "vector": [4, 0, 0.9972, 0.0113, 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 unittest.main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L177_C2", "label": "main()", "type": "expression", "loc": [177, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1153:If_L176_C0", "vector": [8, 1, 1.0, 0.0056, 1, 0.26, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " unittest.main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L74_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L96_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:For_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:For_L99_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L100_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L111_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L115_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L118_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L114_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L120_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L126_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L123_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L129_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L134_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L131_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L142_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L151_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L150_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L155_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:ClassDef_L58_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L165_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L166_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L169_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L170_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L172_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Assign_L173_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:FunctionDef_L158_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L174_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1153:If_L176_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1153:Expr_L177_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Declares the api package."""
| ajibawa-2023/Python-Code-Large/train/row_1155 | 1 | 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_1155:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 1.0, 0.0588, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Declares the api package.\"\"\""}] | [] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Contains various API-specific exception classes.
This module contains various specific exception classes that are raised by
the library back to the client.
"""
class Error(Exception):
"""Base library error type."""
| ajibawa-2023/Python-Code-Large/train/row_1156 | 3 | 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_1156:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 21], "level": 0, "parent": null, "vector": [8, 0, 0.76, 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": "\"\"\"Contains various API-specific exception classes.\n\nThis module contains various specific exception classes that are raised by\nthe library back to the client.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1156:ClassDef_L24_C0", "label": "Error", "type": "class", "loc": [24, 25], "level": 0, "parent": null, "vector": [3, 0, 0.98, 0.08, 0, 0.66, 1.0, 529, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "Error", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Error(Exception):\n \"\"\"Base library error type.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1156:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1156:ClassDef_L24_C0", "vector": [8, 1, 1.0, 0.04, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Base library error type.\"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1156:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1156:Expr_L25_C2"}] |
#!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Defines event types that are sent from the wave server.
This module defines all of the event types currently supported by the wave
server. Each event type is sub classed from Event and has its own
properties depending on the type.
"""
class Context(object):
"""Specifies constants representing different context requests."""
#: Requests the root blip.
ROOT = 'ROOT'
#: Requests the parent blip of the event blip.
PARENT = 'PARENT'
#: Requests the siblings blip of the event blip.
SIBLINGS = 'SIBLINGS'
#: Requests the child blips of the event blip.
CHILDREN = 'CHILDREN'
#: Requests the event blip itself.
SELF = 'SELF'
#: Requests all of the blips of the event wavelet.
ALL = 'ALL'
class Event(object):
"""Object describing a single event.
Attributes:
modified_by: Participant id that caused this event.
timestamp: Timestamp that this event occurred on the server.
type: Type string of this event.
properties: Dictionary of all extra properties. Typically the derrived
event type should have these explicitly set as attributes, but
experimental features might appear in properties before that.
blip_id: The blip_id of the blip for blip related events or the root
blip for wavelet related events.
blip: If available, the blip with id equal to the events blip_id.
proxying_for: If available, the proxyingFor id of the robot that caused the
event.
"""
def __init__(self, json, wavelet):
"""Inits this event with JSON data.
Args:
json: JSON data from Wave server.
"""
self.modified_by = json.get('modifiedBy')
self.timestamp = json.get('timestamp', 0)
self.type = json.get('type')
self.raw_data = json
self.properties = json.get('properties', {})
self.blip_id = self.properties.get('blipId')
self.blip = wavelet.blips.get(self.blip_id)
self.proxying_for = json.get('proxyingFor')
class WaveletBlipCreated(Event):
"""Event triggered when a new blip is created.
Attributes:
new_blip_id: The id of the newly created blip.
new_blip: If in context, the actual new blip.
"""
type = 'WAVELET_BLIP_CREATED'
def __init__(self, json, wavelet):
super(WaveletBlipCreated, self).__init__(json, wavelet)
self.new_blip_id = self.properties['newBlipId']
self.new_blip = wavelet.blips.get(self.new_blip_id)
class WaveletBlipRemoved(Event):
"""Event triggered when a new blip is removed.
Attributes:
removed_blip_id: the id of the removed blip
removed_blip: if in context, the removed blip
"""
type = 'WAVELET_BLIP_REMOVED'
def __init__(self, json, wavelet):
super(WaveletBlipRemoved, self).__init__(json, wavelet)
self.removed_blip_id = self.properties['removedBlipId']
self.removed_blip = wavelet.blips.get(self.removed_blip_id)
class WaveletParticipantsChanged(Event):
"""Event triggered when the participants on a wave change.
Attributes:
participants_added: List of participants added.
participants_removed: List of participants removed.
"""
type = 'WAVELET_PARTICIPANTS_CHANGED'
def __init__(self, json, wavelet):
super(WaveletParticipantsChanged, self).__init__(json, wavelet)
self.participants_added = self.properties['participantsAdded']
self.participants_removed = self.properties['participantsRemoved']
class WaveletSelfAdded(Event):
"""Event triggered when the robot is added to the wavelet."""
type = 'WAVELET_SELF_ADDED'
class WaveletSelfRemoved(Event):
"""Event triggered when the robot is removed from the wavelet."""
type = 'WAVELET_SELF_REMOVED'
class WaveletTitleChanged(Event):
"""Event triggered when the title of the wavelet has changed.
Attributes:
title: The new title.
"""
type = 'WAVELET_TITLE_CHANGED'
def __init__(self, json, wavelet):
super(WaveletTitleChanged, self).__init__(json, wavelet)
self.title = self.properties['title']
class BlipContributorsChanged(Event):
"""Event triggered when the contributors to this blip change.
Attributes:
contributors_added: List of contributors that were added.
contributors_removed: List of contributors that were removed.
"""
type = 'BLIP_CONTRIBUTORS_CHANGED'
def __init__(self, json, wavelet):
super(BlipContributorsChanged, self).__init__(json, wavelet)
self.contibutors_added = self.properties['contributorsAdded']
self.contibutors_removed = self.properties['contributorsRemoved']
class BlipSubmitted(Event):
"""Event triggered when a blip is submitted."""
type = 'BLIP_SUBMITTED'
class DocumentChanged(Event):
"""Event triggered when a document is changed.
This event is fired after any changes in the document and should be used
carefully to keep the amount of traffic to the robot reasonable. Use
filters where appropriate.
"""
type = 'DOCUMENT_CHANGED'
class FormButtonClicked(Event):
"""Event triggered when a form button is clicked.
Attributes:
button_name: The name of the button that was clicked.
"""
type = 'FORM_BUTTON_CLICKED'
def __init__(self, json, wavelet):
super(FormButtonClicked, self).__init__(json, wavelet)
self.button_name = self.properties['buttonName']
class GadgetStateChanged(Event):
"""Event triggered when the state of a gadget changes.
Attributes:
index: The index of the gadget that changed in the document.
old_state: The old state of the gadget.
"""
type = 'GADGET_STATE_CHANGED'
def __init__(self, json, wavelet):
super(GadgetStateChanged, self).__init__(json, wavelet)
self.index = self.properties['index']
self.old_state = self.properties['oldState']
class AnnotatedTextChanged(Event):
"""Event triggered when text with an annotation has changed.
This is mainly useful in combination with a filter on the
name of the annotation.
Attributes:
name: The name of the annotation.
value: The value of the annotation that changed.
"""
type = 'ANNOTATED_TEXT_CHANGED'
def __init__(self, json, wavelet):
super(AnnotatedTextChanged, self).__init__(json, wavelet)
self.name = self.properties['name']
self.value = self.properties.get('value')
class OperationError(Event):
"""Triggered when an event on the server occurred.
Attributes:
operation_id: The operation id of the failing operation.
error_message: More information as to what went wrong.
"""
type = 'OPERATION_ERROR'
def __init__(self, json, wavelet):
super(OperationError, self).__init__(json, wavelet)
self.operation_id = self.properties['operationId']
self.error_message = self.properties['message']
class WaveletCreated(Event):
"""Triggered when a new wavelet is created.
This event is only triggered if the robot creates a new
wavelet and can be used to initialize the newly created wave.
wavelets created by other participants remain invisible
to the robot until the robot is added to the wave in
which case WaveletSelfAdded is triggered.
Attributes:
message: Whatever string was passed into the new_wave
call as message (if any).
"""
type = 'WAVELET_CREATED'
def __init__(self, json, wavelet):
super(WaveletCreated, self).__init__(json, wavelet)
self.message = self.properties['message']
class WaveletFetched(Event):
"""Triggered when a new wavelet is fetched.
This event is triggered after a robot requests to
see another wavelet. The robot has to be on the other
wavelet already.
Attributes:
message: Whatever string was passed into the new_wave
call as message (if any).
"""
type = 'WAVELET_FETCHED'
def __init__(self, json, wavelet):
super(WaveletFetched, self).__init__(json, wavelet)
self.message = self.properties['message']
class WaveletTagsChanged(Event):
"""Event triggered when the tags on a wavelet change."""
type = 'WAVELET_TAGS_CHANGED'
def __init__(self, json, wavelet):
super(WaveletTagsChanged, self).__init__(json, wavelet)
def is_event(cls):
"""Returns whether the passed class is an event."""
try:
if not issubclass(cls, Event):
return False
return hasattr(cls, 'type')
except TypeError:
return False
ALL = [item for item in globals().copy().values() if is_event(item)]
| ajibawa-2023/Python-Code-Large/train/row_1157 | 119 | 301 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 22], "level": 0, "parent": null, "vector": [8, 0, 0.0648, 0.0199, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Defines event types that are sent from the wave server.\n\nThis module defines all of the event types currently supported by the wave\nserver. Each event type is sub classed from Event and has its own\nproperties depending on the type.\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "label": "Context", "type": "class", "loc": [25, 39], "level": 0, "parent": null, "vector": [3, 0, 0.1063, 0.0498, 0, 0.66, 0.05, 560, 0, 0, 0, 0, 186, 0, 0], "semantic": {"name": "Context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Context(object):\n \"\"\"Specifies constants representing different context requests.\"\"\"\n\n #: Requests the root blip.\n ROOT = 'ROOT'\n #: Requests the parent blip of the event blip.\n PARENT = 'PARENT'\n #: Requests the siblings blip of the event blip."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L26_C2", "label": "expression", "type": "expression", "loc": [26, 26], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [8, 1, 0.0864, 0.0033, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Specifies constants representing different context requests.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L29_C2", "label": "ROOT =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.0963, 0.0033, 1, 0.31, 0.1667, 986, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ROOT = 'ROOT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L31_C2", "label": "PARENT =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.103, 0.0033, 1, 0.31, 0.3333, 678, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "PARENT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " PARENT = 'PARENT'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L33_C2", "label": "SIBLINGS =", "type": "assigned_variable", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.1096, 0.0033, 1, 0.31, 0.5, 912, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SIBLINGS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SIBLINGS = 'SIBLINGS'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L35_C2", "label": "CHILDREN =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.1163, 0.0033, 1, 0.31, 0.6667, 404, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "CHILDREN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " CHILDREN = 'CHILDREN'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L37_C2", "label": "SELF =", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.1229, 0.0033, 1, 0.31, 0.8333, 296, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SELF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " SELF = 'SELF'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L39_C2", "label": "ALL =", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "vector": [14, 1, 0.1296, 0.0033, 1, 0.31, 1.0, 431, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ALL = 'ALL'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L42_C0", "label": "Event", "type": "class", "loc": [42, 78], "level": 0, "parent": null, "vector": [3, 0, 0.1993, 0.1229, 0, 0.66, 0.1, 9, 0, 1, 0, 0, 186, 0, 7], "semantic": {"name": "Event", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Event(object):\n \"\"\"Object describing a single event.\n\n Attributes:\n modified_by: Participant id that caused this event.\n\n timestamp: Timestamp that this event occurred on the server.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L43_C2", "label": "expression", "type": "expression", "loc": [43, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L42_C0", "vector": [8, 1, 0.1761, 0.0698, 1, 0.73, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Object describing a single event.\n\n Attributes:\n modified_by: Participant id that caused this event.\n\n timestamp: Timestamp that this event occurred on the server.\n\n type: Type string of this event."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "label": "__init__", "type": "function", "loc": [65, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L42_C0", "vector": [2, 1, 0.2375, 0.0465, 1, 0.73, 1.0, 555, 0, 3, 0, 0, 0, 0, 7], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n \"\"\"Inits this event with JSON data.\n\n Args:\n json: JSON data from Wave server.\n \"\"\"\n self.modified_by = json.get('modifiedBy')\n self.timestamp = json.get('timestamp', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L66_C4", "label": "expression", "type": "expression", "loc": [66, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [8, 2, 0.2259, 0.0166, 2, 0.39, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Inits this event with JSON data.\n\n Args:\n json: JSON data from Wave server.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L71_C4", "label": "self.modified_by = get()", "type": "assigned_variable", "loc": [71, 71], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2359, 0.0033, 2, 0.39, 0.125, 212, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.modified_by", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.modified_by = json.get('modifiedBy')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L72_C4", "label": "self.timestamp = get()", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2392, 0.0033, 2, 0.39, 0.25, 297, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self.timestamp", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.timestamp = json.get('timestamp', 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L73_C4", "label": "self.type = get()", "type": "assigned_variable", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2425, 0.0033, 2, 0.39, 0.375, 398, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.type", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.type = json.get('type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L74_C4", "label": "self.raw_data =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2458, 0.0033, 2, 0.39, 0.5, 25, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.raw_data", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.raw_data = json"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L75_C4", "label": "self.properties = get()", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2492, 0.0033, 2, 0.39, 0.625, 48, 3, 2, 0, 0, 607, 10, 1], "semantic": {"name": "self.properties", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.properties = json.get('properties', {})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L76_C4", "label": "self.blip_id = get()", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2525, 0.0033, 2, 0.39, 0.75, 149, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.blip_id = self.properties.get('blipId')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L77_C4", "label": "self.blip = get()", "type": "assigned_variable", "loc": [77, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2558, 0.0033, 2, 0.39, 0.875, 949, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.blip = wavelet.blips.get(self.blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L78_C4", "label": "self.proxying_for = get()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "vector": [14, 2, 0.2591, 0.0033, 2, 0.39, 1.0, 267, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.proxying_for", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.proxying_for = json.get('proxyingFor')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "label": "WaveletBlipCreated", "type": "class", "loc": [80, 93], "level": 0, "parent": null, "vector": [3, 0, 0.2874, 0.0465, 0, 0.66, 0.15, 762, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "WaveletBlipCreated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletBlipCreated(Event):\n \"\"\"Event triggered when a new blip is created.\n\n Attributes:\n new_blip_id: The id of the newly created blip.\n\n new_blip: If in context, the actual new blip.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L81_C2", "label": "expression", "type": "expression", "loc": [81, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "vector": [8, 1, 0.2791, 0.0233, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a new blip is created.\n\n Attributes:\n new_blip_id: The id of the newly created blip.\n\n new_blip: If in context, the actual new blip.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L88_C2", "label": "type =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "vector": [14, 1, 0.2924, 0.0033, 1, 0.45, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_BLIP_CREATED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "label": "__init__", "type": "function", "loc": [90, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "vector": [2, 1, 0.304, 0.0133, 1, 0.45, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletBlipCreated, self).__init__(json, wavelet)\n self.new_blip_id = self.properties['newBlipId']\n self.new_blip = wavelet.blips.get(self.new_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L91_C4", "label": "__init__()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "vector": [8, 2, 0.3023, 0.0033, 2, 0.19, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletBlipCreated, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L92_C4", "label": "self.new_blip_id =", "type": "assigned_variable", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "vector": [14, 2, 0.3056, 0.0033, 2, 0.19, 0.5, 631, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.new_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.new_blip_id = self.properties['newBlipId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L93_C4", "label": "self.new_blip = get()", "type": "assigned_variable", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "vector": [14, 2, 0.309, 0.0033, 2, 0.19, 1.0, 463, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.new_blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.new_blip = wavelet.blips.get(self.new_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "label": "WaveletBlipRemoved", "type": "class", "loc": [96, 109], "level": 0, "parent": null, "vector": [3, 0, 0.3405, 0.0465, 0, 0.66, 0.2, 618, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "WaveletBlipRemoved", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletBlipRemoved(Event):\n \"\"\"Event triggered when a new blip is removed.\n\n Attributes:\n removed_blip_id: the id of the removed blip\n\n removed_blip: if in context, the removed blip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L97_C2", "label": "expression", "type": "expression", "loc": [97, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "vector": [8, 1, 0.3322, 0.0233, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a new blip is removed.\n\n Attributes:\n removed_blip_id: the id of the removed blip\n\n removed_blip: if in context, the removed blip\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L104_C2", "label": "type =", "type": "assigned_variable", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "vector": [14, 1, 0.3455, 0.0033, 1, 0.74, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_BLIP_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "label": "__init__", "type": "function", "loc": [106, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "vector": [2, 1, 0.3571, 0.0133, 1, 0.74, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletBlipRemoved, self).__init__(json, wavelet)\n self.removed_blip_id = self.properties['removedBlipId']\n self.removed_blip = wavelet.blips.get(self.removed_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L107_C4", "label": "__init__()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "vector": [8, 2, 0.3555, 0.0033, 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(WaveletBlipRemoved, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L108_C4", "label": "self.removed_blip_id =", "type": "assigned_variable", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "vector": [14, 2, 0.3588, 0.0033, 2, 0.78, 0.5, 936, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.removed_blip_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.removed_blip_id = self.properties['removedBlipId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L109_C4", "label": "self.removed_blip = get()", "type": "assigned_variable", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "vector": [14, 2, 0.3621, 0.0033, 2, 0.78, 1.0, 946, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.removed_blip", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.removed_blip = wavelet.blips.get(self.removed_blip_id)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "label": "WaveletParticipantsChanged", "type": "class", "loc": [112, 125], "level": 0, "parent": null, "vector": [3, 0, 0.3937, 0.0465, 0, 0.66, 0.25, 1, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletParticipantsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletParticipantsChanged(Event):\n \"\"\"Event triggered when the participants on a wave change.\n\n Attributes:\n participants_added: List of participants added.\n\n participants_removed: List of participants removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L113_C2", "label": "expression", "type": "expression", "loc": [113, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "vector": [8, 1, 0.3854, 0.0233, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the participants on a wave change.\n\n Attributes:\n participants_added: List of participants added.\n\n participants_removed: List of participants removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L120_C2", "label": "type =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "vector": [14, 1, 0.3987, 0.0033, 1, 0.82, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_PARTICIPANTS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "label": "__init__", "type": "function", "loc": [122, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "vector": [2, 1, 0.4103, 0.0133, 1, 0.82, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletParticipantsChanged, self).__init__(json, wavelet)\n self.participants_added = self.properties['participantsAdded']\n self.participants_removed = self.properties['participantsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L123_C4", "label": "__init__()", "type": "expression", "loc": [123, 123], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "vector": [8, 2, 0.4086, 0.0033, 2, 0.09, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletParticipantsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L124_C4", "label": "self.participants_added =", "type": "assigned_variable", "loc": [124, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "vector": [14, 2, 0.412, 0.0033, 2, 0.09, 0.5, 40, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.participants_added", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.participants_added = self.properties['participantsAdded']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L125_C4", "label": "self.participants_removed =", "type": "assigned_variable", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "vector": [14, 2, 0.4153, 0.0033, 2, 0.09, 1.0, 763, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.participants_removed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.participants_removed = self.properties['participantsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L128_C0", "label": "WaveletSelfAdded", "type": "class", "loc": [128, 130], "level": 0, "parent": null, "vector": [3, 0, 0.4286, 0.01, 0, 0.66, 0.3, 757, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "WaveletSelfAdded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletSelfAdded(Event):\n \"\"\"Event triggered when the robot is added to the wavelet.\"\"\"\n type = 'WAVELET_SELF_ADDED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L129_C2", "label": "expression", "type": "expression", "loc": [129, 129], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L128_C0", "vector": [8, 1, 0.4286, 0.0033, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the robot is added to the wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L130_C2", "label": "type =", "type": "assigned_variable", "loc": [130, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L128_C0", "vector": [14, 1, 0.4319, 0.0033, 1, 0.81, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_SELF_ADDED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L133_C0", "label": "WaveletSelfRemoved", "type": "class", "loc": [133, 135], "level": 0, "parent": null, "vector": [3, 0, 0.4452, 0.01, 0, 0.66, 0.35, 823, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "WaveletSelfRemoved", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletSelfRemoved(Event):\n \"\"\"Event triggered when the robot is removed from the wavelet.\"\"\"\n type = 'WAVELET_SELF_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L134_C2", "label": "expression", "type": "expression", "loc": [134, 134], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L133_C0", "vector": [8, 1, 0.4452, 0.0033, 1, 0.68, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the robot is removed from the wavelet.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L135_C2", "label": "type =", "type": "assigned_variable", "loc": [135, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L133_C0", "vector": [14, 1, 0.4485, 0.0033, 1, 0.68, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_SELF_REMOVED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "label": "WaveletTitleChanged", "type": "class", "loc": [138, 148], "level": 0, "parent": null, "vector": [3, 0, 0.4751, 0.0365, 0, 0.66, 0.4, 196, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletTitleChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletTitleChanged(Event):\n \"\"\"Event triggered when the title of the wavelet has changed.\n\n Attributes:\n title: The new title.\n \"\"\"\n type = 'WAVELET_TITLE_CHANGED'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L139_C2", "label": "expression", "type": "expression", "loc": [139, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "vector": [8, 1, 0.4684, 0.0166, 1, 0.16, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the title of the wavelet has changed.\n\n Attributes:\n title: The new title.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L144_C2", "label": "type =", "type": "assigned_variable", "loc": [144, 144], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "vector": [14, 1, 0.4784, 0.0033, 1, 0.16, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_TITLE_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2", "label": "__init__", "type": "function", "loc": [146, 148], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "vector": [2, 1, 0.4884, 0.01, 1, 0.16, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletTitleChanged, self).__init__(json, wavelet)\n self.title = self.properties['title']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L147_C4", "label": "__init__()", "type": "expression", "loc": [147, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2", "vector": [8, 2, 0.4884, 0.0033, 2, 0.3, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletTitleChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L148_C4", "label": "self.title =", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2", "vector": [14, 2, 0.4917, 0.0033, 2, 0.3, 1.0, 629, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.title = self.properties['title']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "label": "BlipContributorsChanged", "type": "class", "loc": [151, 164], "level": 0, "parent": null, "vector": [3, 0, 0.5233, 0.0465, 0, 0.66, 0.45, 475, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "BlipContributorsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipContributorsChanged(Event):\n \"\"\"Event triggered when the contributors to this blip change.\n\n Attributes:\n contributors_added: List of contributors that were added.\n\n contributors_removed: List of contributors that were removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L152_C2", "label": "expression", "type": "expression", "loc": [152, 158], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "vector": [8, 1, 0.515, 0.0233, 1, 0.77, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the contributors to this blip change.\n\n Attributes:\n contributors_added: List of contributors that were added.\n\n contributors_removed: List of contributors that were removed.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L159_C2", "label": "type =", "type": "assigned_variable", "loc": [159, 159], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "vector": [14, 1, 0.5282, 0.0033, 1, 0.77, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'BLIP_CONTRIBUTORS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "label": "__init__", "type": "function", "loc": [161, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "vector": [2, 1, 0.5399, 0.0133, 1, 0.77, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(BlipContributorsChanged, self).__init__(json, wavelet)\n self.contibutors_added = self.properties['contributorsAdded']\n self.contibutors_removed = self.properties['contributorsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L162_C4", "label": "__init__()", "type": "expression", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "vector": [8, 2, 0.5382, 0.0033, 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(BlipContributorsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L163_C4", "label": "self.contibutors_added =", "type": "assigned_variable", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "vector": [14, 2, 0.5415, 0.0033, 2, 0.35, 0.5, 43, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.contibutors_added", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.contibutors_added = self.properties['contributorsAdded']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L164_C4", "label": "self.contibutors_removed =", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "vector": [14, 2, 0.5449, 0.0033, 2, 0.35, 1.0, 291, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.contibutors_removed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.contibutors_removed = self.properties['contributorsRemoved']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L167_C0", "label": "BlipSubmitted", "type": "class", "loc": [167, 169], "level": 0, "parent": null, "vector": [3, 0, 0.5581, 0.01, 0, 0.66, 0.5, 150, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "BlipSubmitted", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BlipSubmitted(Event):\n \"\"\"Event triggered when a blip is submitted.\"\"\"\n type = 'BLIP_SUBMITTED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L168_C2", "label": "expression", "type": "expression", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L167_C0", "vector": [8, 1, 0.5581, 0.0033, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a blip is submitted.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L169_C2", "label": "type =", "type": "assigned_variable", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L167_C0", "vector": [14, 1, 0.5615, 0.0033, 1, 0.82, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'BLIP_SUBMITTED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L172_C0", "label": "DocumentChanged", "type": "class", "loc": [172, 179], "level": 0, "parent": null, "vector": [3, 0, 0.5831, 0.0266, 0, 0.66, 0.55, 123, 0, 0, 0, 0, 9, 0, 0], "semantic": {"name": "DocumentChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class DocumentChanged(Event):\n \"\"\"Event triggered when a document is changed.\n\n This event is fired after any changes in the document and should be used\n carefully to keep the amount of traffic to the robot reasonable. Use\n filters where appropriate.\n \"\"\"\n type = 'DOCUMENT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L173_C2", "label": "expression", "type": "expression", "loc": [173, 178], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L172_C0", "vector": [8, 1, 0.5831, 0.0199, 1, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a document is changed.\n\n This event is fired after any changes in the document and should be used\n carefully to keep the amount of traffic to the robot reasonable. Use\n filters where appropriate.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L179_C2", "label": "type =", "type": "assigned_variable", "loc": [179, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L172_C0", "vector": [14, 1, 0.5947, 0.0033, 1, 0.66, 1.0, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'DOCUMENT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "label": "FormButtonClicked", "type": "class", "loc": [182, 192], "level": 0, "parent": null, "vector": [3, 0, 0.6213, 0.0365, 0, 0.66, 0.6, 639, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "FormButtonClicked", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FormButtonClicked(Event):\n \"\"\"Event triggered when a form button is clicked.\n\n Attributes:\n button_name: The name of the button that was clicked.\n \"\"\"\n type = 'FORM_BUTTON_CLICKED'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L183_C2", "label": "expression", "type": "expression", "loc": [183, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "vector": [8, 1, 0.6146, 0.0166, 1, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when a form button is clicked.\n\n Attributes:\n button_name: The name of the button that was clicked.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L188_C2", "label": "type =", "type": "assigned_variable", "loc": [188, 188], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "vector": [14, 1, 0.6246, 0.0033, 1, 0.4, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'FORM_BUTTON_CLICKED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2", "label": "__init__", "type": "function", "loc": [190, 192], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "vector": [2, 1, 0.6346, 0.01, 1, 0.4, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(FormButtonClicked, self).__init__(json, wavelet)\n self.button_name = self.properties['buttonName']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L191_C4", "label": "__init__()", "type": "expression", "loc": [191, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2", "vector": [8, 2, 0.6346, 0.0033, 2, 0.03, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(FormButtonClicked, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L192_C4", "label": "self.button_name =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2", "vector": [14, 2, 0.6379, 0.0033, 2, 0.03, 1.0, 833, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.button_name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.button_name = self.properties['buttonName']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "label": "GadgetStateChanged", "type": "class", "loc": [195, 208], "level": 0, "parent": null, "vector": [3, 0, 0.6694, 0.0465, 0, 0.66, 0.65, 393, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "GadgetStateChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class GadgetStateChanged(Event):\n \"\"\"Event triggered when the state of a gadget changes.\n\n Attributes:\n index: The index of the gadget that changed in the document.\n\n old_state: The old state of the gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L196_C2", "label": "expression", "type": "expression", "loc": [196, 202], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "vector": [8, 1, 0.6611, 0.0233, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the state of a gadget changes.\n\n Attributes:\n index: The index of the gadget that changed in the document.\n\n old_state: The old state of the gadget.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L203_C2", "label": "type =", "type": "assigned_variable", "loc": [203, 203], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "vector": [14, 1, 0.6744, 0.0033, 1, 0.94, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'GADGET_STATE_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "label": "__init__", "type": "function", "loc": [205, 208], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "vector": [2, 1, 0.686, 0.0133, 1, 0.94, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(GadgetStateChanged, self).__init__(json, wavelet)\n self.index = self.properties['index']\n self.old_state = self.properties['oldState']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L206_C4", "label": "__init__()", "type": "expression", "loc": [206, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "vector": [8, 2, 0.6844, 0.0033, 2, 0.85, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(GadgetStateChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L207_C4", "label": "self.index =", "type": "assigned_variable", "loc": [207, 207], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "vector": [14, 2, 0.6877, 0.0033, 2, 0.85, 0.5, 777, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.index = self.properties['index']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L208_C4", "label": "self.old_state =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "vector": [14, 2, 0.691, 0.0033, 2, 0.85, 1.0, 730, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.old_state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.old_state = self.properties['oldState']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "label": "AnnotatedTextChanged", "type": "class", "loc": [211, 227], "level": 0, "parent": null, "vector": [3, 0, 0.7276, 0.0565, 0, 0.66, 0.7, 886, 0, 1, 0, 0, 9, 0, 3], "semantic": {"name": "AnnotatedTextChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AnnotatedTextChanged(Event):\n \"\"\"Event triggered when text with an annotation has changed.\n\n This is mainly useful in combination with a filter on the\n name of the annotation.\n\n Attributes:\n name: The name of the annotation."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L212_C2", "label": "expression", "type": "expression", "loc": [212, 221], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "vector": [8, 1, 0.7193, 0.0332, 1, 0.36, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when text with an annotation has changed.\n\n This is mainly useful in combination with a filter on the\n name of the annotation.\n\n Attributes:\n name: The name of the annotation.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L222_C2", "label": "type =", "type": "assigned_variable", "loc": [222, 222], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "vector": [14, 1, 0.7375, 0.0033, 1, 0.36, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'ANNOTATED_TEXT_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "label": "__init__", "type": "function", "loc": [224, 227], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "vector": [2, 1, 0.7492, 0.0133, 1, 0.36, 1.0, 555, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(AnnotatedTextChanged, self).__init__(json, wavelet)\n self.name = self.properties['name']\n self.value = self.properties.get('value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L225_C4", "label": "__init__()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "vector": [8, 2, 0.7475, 0.0033, 2, 0.86, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(AnnotatedTextChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L226_C4", "label": "self.name =", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "vector": [14, 2, 0.7508, 0.0033, 2, 0.86, 0.5, 689, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.name", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.name = self.properties['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L227_C4", "label": "self.value = get()", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "vector": [14, 2, 0.7542, 0.0033, 2, 0.86, 1.0, 966, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "self.value", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " self.value = self.properties.get('value')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "label": "OperationError", "type": "class", "loc": [230, 243], "level": 0, "parent": null, "vector": [3, 0, 0.7857, 0.0465, 0, 0.66, 0.75, 796, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "OperationError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OperationError(Event):\n \"\"\"Triggered when an event on the server occurred.\n\n Attributes:\n operation_id: The operation id of the failing operation.\n\n error_message: More information as to what went wrong.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L231_C2", "label": "expression", "type": "expression", "loc": [231, 237], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "vector": [8, 1, 0.7774, 0.0233, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when an event on the server occurred.\n\n Attributes:\n operation_id: The operation id of the failing operation.\n\n error_message: More information as to what went wrong.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L238_C2", "label": "type =", "type": "assigned_variable", "loc": [238, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "vector": [14, 1, 0.7907, 0.0033, 1, 0.67, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'OPERATION_ERROR'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "label": "__init__", "type": "function", "loc": [240, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "vector": [2, 1, 0.8023, 0.0133, 1, 0.67, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(OperationError, self).__init__(json, wavelet)\n self.operation_id = self.properties['operationId']\n self.error_message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L241_C4", "label": "__init__()", "type": "expression", "loc": [241, 241], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "vector": [8, 2, 0.8007, 0.0033, 2, 0.22, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(OperationError, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L242_C4", "label": "self.operation_id =", "type": "assigned_variable", "loc": [242, 242], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "vector": [14, 2, 0.804, 0.0033, 2, 0.22, 0.5, 783, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.operation_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.operation_id = self.properties['operationId']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L243_C4", "label": "self.error_message =", "type": "assigned_variable", "loc": [243, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "vector": [14, 2, 0.8073, 0.0033, 2, 0.22, 1.0, 96, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.error_message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.error_message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "label": "WaveletCreated", "type": "class", "loc": [246, 263], "level": 0, "parent": null, "vector": [3, 0, 0.8455, 0.0598, 0, 0.66, 0.8, 391, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletCreated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletCreated(Event):\n \"\"\"Triggered when a new wavelet is created.\n\n This event is only triggered if the robot creates a new\n wavelet and can be used to initialize the newly created wave.\n wavelets created by other participants remain invisible\n to the robot until the robot is added to the wave in\n which case WaveletSelfAdded is triggered."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L247_C2", "label": "expression", "type": "expression", "loc": [247, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "vector": [8, 1, 0.8389, 0.0399, 1, 0.28, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when a new wavelet is created.\n\n This event is only triggered if the robot creates a new\n wavelet and can be used to initialize the newly created wave.\n wavelets created by other participants remain invisible\n to the robot until the robot is added to the wave in\n which case WaveletSelfAdded is triggered.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L259_C2", "label": "type =", "type": "assigned_variable", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "vector": [14, 1, 0.8605, 0.0033, 1, 0.28, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_CREATED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2", "label": "__init__", "type": "function", "loc": [261, 263], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "vector": [2, 1, 0.8704, 0.01, 1, 0.28, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletCreated, self).__init__(json, wavelet)\n self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L262_C4", "label": "__init__()", "type": "expression", "loc": [262, 262], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2", "vector": [8, 2, 0.8704, 0.0033, 2, 0.29, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletCreated, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L263_C4", "label": "self.message =", "type": "assigned_variable", "loc": [263, 263], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2", "vector": [14, 2, 0.8738, 0.0033, 2, 0.29, 1.0, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "label": "WaveletFetched", "type": "class", "loc": [266, 281], "level": 0, "parent": null, "vector": [3, 0, 0.9086, 0.0532, 0, 0.66, 0.85, 429, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletFetched", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletFetched(Event):\n \"\"\"Triggered when a new wavelet is fetched.\n\n This event is triggered after a robot requests to\n see another wavelet. The robot has to be on the other\n wavelet already.\n\n Attributes:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L267_C2", "label": "expression", "type": "expression", "loc": [267, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "vector": [8, 1, 0.902, 0.0332, 1, 0.83, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Triggered when a new wavelet is fetched.\n\n This event is triggered after a robot requests to\n see another wavelet. The robot has to be on the other\n wavelet already.\n\n Attributes:\n message: Whatever string was passed into the new_wave"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L277_C2", "label": "type =", "type": "assigned_variable", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "vector": [14, 1, 0.9203, 0.0033, 1, 0.83, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_FETCHED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2", "label": "__init__", "type": "function", "loc": [279, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "vector": [2, 1, 0.9302, 0.01, 1, 0.83, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletFetched, self).__init__(json, wavelet)\n self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L280_C4", "label": "__init__()", "type": "expression", "loc": [280, 280], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2", "vector": [8, 2, 0.9302, 0.0033, 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(WaveletFetched, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L281_C4", "label": "self.message =", "type": "assigned_variable", "loc": [281, 281], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2", "vector": [14, 2, 0.9336, 0.0033, 2, 0.35, 1.0, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self.message", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.message = self.properties['message']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "label": "WaveletTagsChanged", "type": "class", "loc": [284, 289], "level": 0, "parent": null, "vector": [3, 0, 0.9518, 0.0199, 0, 0.66, 0.9, 141, 0, 1, 0, 0, 9, 0, 2], "semantic": {"name": "WaveletTagsChanged", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class WaveletTagsChanged(Event):\n \"\"\"Event triggered when the tags on a wavelet change.\"\"\"\n type = 'WAVELET_TAGS_CHANGED'\n\n def __init__(self, json, wavelet):\n super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L285_C2", "label": "expression", "type": "expression", "loc": [285, 285], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "vector": [8, 1, 0.9468, 0.0033, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Event triggered when the tags on a wavelet change.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L286_C2", "label": "type =", "type": "assigned_variable", "loc": [286, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "vector": [14, 1, 0.9502, 0.0033, 1, 0.27, 0.5, 801, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " type = 'WAVELET_TAGS_CHANGED'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L288_C2", "label": "__init__", "type": "function", "loc": [288, 289], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "vector": [2, 1, 0.9585, 0.0066, 1, 0.27, 1.0, 555, 0, 3, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": ["self", "json", "wavelet"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, json, wavelet):\n super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L289_C4", "label": "__init__()", "type": "expression", "loc": [289, 289], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L288_C2", "vector": [8, 2, 0.9601, 0.0033, 2, 0.12, 0.0, 555, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(WaveletTagsChanged, self).__init__(json, wavelet)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L292_C0", "label": "is_event", "type": "function", "loc": [292, 299], "level": 0, "parent": null, "vector": [2, 0, 0.9817, 0.0266, 0, 0.66, 0.95, 63, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "is_event", "arg_names": ["cls"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def is_event(cls):\n \"\"\"Returns whether the passed class is an event.\"\"\"\n try:\n if not issubclass(cls, Event):\n return False\n return hasattr(cls, 'type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L293_C2", "label": "expression", "type": "expression", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L292_C0", "vector": [8, 1, 0.9734, 0.0033, 1, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns whether the passed class is an event.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "label": "try", "type": "try", "loc": [294, 299], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L292_C0", "vector": [7, 1, 0.985, 0.0199, 1, 0.46, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n if not issubclass(cls, Event):\n return False\n return hasattr(cls, 'type')\n except TypeError:\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:If_L295_C4", "label": "if", "type": "if", "loc": [295, 296], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "vector": [4, 2, 0.9817, 0.0066, 2, 0.13, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not issubclass(cls, Event):\n return False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Return_L296_C6", "label": "return", "type": "return", "loc": [296, 296], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:If_L295_C4", "vector": [13, 3, 0.9834, 0.0033, 3, 0.38, 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_1157:Return_L297_C4", "label": "return", "type": "return", "loc": [297, 297], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "vector": [13, 2, 0.9867, 0.0033, 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 hasattr(cls, 'type')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1157:Return_L299_C4", "label": "return", "type": "return", "loc": [299, 299], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "vector": [13, 2, 0.9934, 0.0033, 2, 0.13, 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_1157:Assign_L301_C0", "label": "ALL =", "type": "assigned_variable", "loc": [301, 301], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.0033, 0, 0.66, 1.0, 431, 5, 0, 0, 0, 0, 0, 4], "semantic": {"name": "ALL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ALL = [item for item in globals().copy().values() if is_event(item)]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L26_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L80_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L124_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L130_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L133_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L135_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L144_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L138_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L147_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L146_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L152_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L159_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L151_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L161_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L167_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L169_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L173_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L179_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L183_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L182_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L191_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L190_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L196_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L203_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L195_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L206_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L205_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L212_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L222_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L211_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L224_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L231_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L238_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L230_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L241_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L242_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L240_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L243_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L247_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L259_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L246_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L262_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L261_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L263_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L267_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L277_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L266_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L280_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L279_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L281_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L285_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Assign_L286_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:ClassDef_L284_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L288_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L288_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L289_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Expr_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:FunctionDef_L292_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:If_L295_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:If_L295_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Return_L296_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Return_L297_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1157:Try_L294_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1157:Return_L299_C4"}] |
#! /usr/bin/python
# -*- coding: UTF-8 -*-
from notifiy.robot import create_robot
if __name__ == '__main__':
create_robot()
| ajibawa-2023/Python-Code-Large/train/row_1158 | 3 | 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_1158:ImportFrom_L4_C0", "label": "from notifiy.robot import create_robot", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.5, 0.125, 0, 0.66, 0.0, 413, 0, 1, 0, 0, 413, 0, 0], "semantic": {"name": "notifiy.robot", "arg_names": [], "import_names": ["create_robot"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.robot import create_robot"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1158:If_L7_C0", "label": "if", "type": "if", "loc": [7, 8], "level": 0, "parent": null, "vector": [4, 0, 0.9375, 0.25, 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 create_robot()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1158:Expr_L8_C4", "label": "create_robot()", "type": "expression", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1158:If_L7_C0", "vector": [8, 1, 1.0, 0.125, 1, 0.83, 0.0, 641, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "create_robot", "arg_names": [], "import_names": [], "rhs_call_name": "create_robot", "annotation": ""}, "snippet": " create_robot()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1158:If_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1158:Expr_L8_C4"}] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from notifiy.home import Home
from notifiy.proc import Process
from notifiy.proc_phone import PhoneProcess
from notifiy.receive_email import ReceiveEmail
if __name__ == "__main__":
run_wsgi_app(webapp.WSGIApplication([ ('/', Home),
('/proc/.*', Process),
('/phone/.*', PhoneProcess),
('/_ah/mail/.+', ReceiveEmail) ]))
| ajibawa-2023/Python-Code-Large/train/row_1159 | 8 | 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_1159:ImportFrom_L4_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.2353, 0.0588, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:ImportFrom_L5_C0", "label": "from google.appengine.ext.webapp.util import run_wsgi_app", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.2941, 0.0588, 0, 0.66, 0.1667, 327, 0, 1, 0, 0, 327, 0, 0], "semantic": {"name": "google.appengine.ext.webapp.util", "arg_names": [], "import_names": ["run_wsgi_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp.util import run_wsgi_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:ImportFrom_L7_C0", "label": "from notifiy.home import Home", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.4118, 0.0588, 0, 0.66, 0.3333, 438, 0, 1, 0, 0, 438, 0, 0], "semantic": {"name": "notifiy.home", "arg_names": [], "import_names": ["Home"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.home import Home"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:ImportFrom_L8_C0", "label": "from notifiy.proc import Process", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.4706, 0.0588, 0, 0.66, 0.5, 359, 0, 1, 0, 0, 359, 0, 0], "semantic": {"name": "notifiy.proc", "arg_names": [], "import_names": ["Process"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.proc import Process"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:ImportFrom_L9_C0", "label": "from notifiy.proc_phone import PhoneProcess", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.5294, 0.0588, 0, 0.66, 0.6667, 731, 0, 1, 0, 0, 731, 0, 0], "semantic": {"name": "notifiy.proc_phone", "arg_names": [], "import_names": ["PhoneProcess"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.proc_phone import PhoneProcess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:ImportFrom_L10_C0", "label": "from notifiy.receive_email import ReceiveEmail", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.5882, 0.0588, 0, 0.66, 0.8333, 103, 0, 1, 0, 0, 103, 0, 0], "semantic": {"name": "notifiy.receive_email", "arg_names": [], "import_names": ["ReceiveEmail"], "rhs_call_name": "", "annotation": ""}, "snippet": "from notifiy.receive_email import ReceiveEmail"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:If_L13_C0", "label": "if", "type": "if", "loc": [13, 17], "level": 0, "parent": null, "vector": [4, 0, 0.8824, 0.2941, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n run_wsgi_app(webapp.WSGIApplication([ ('/', Home),\n ('/proc/.*', Process),\n ('/phone/.*', PhoneProcess),\n ('/_ah/mail/.+', ReceiveEmail) ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1159:Expr_L14_C4", "label": "run_wsgi_app()", "type": "expression", "loc": [14, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1159:If_L13_C0", "vector": [8, 1, 0.9118, 0.2353, 1, 0.89, 0.0, 563, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " run_wsgi_app(webapp.WSGIApplication([ ('/', Home),\n ('/proc/.*', Process),\n ('/phone/.*', PhoneProcess),\n ('/_ah/mail/.+', ReceiveEmail) ]))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1159:If_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1159:Expr_L14_C4"}] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class Index(webapp.RequestHandler):
def get(self):
self.redirect('%s/index.html' % self.request.path)
if __name__ == "__main__":
run_wsgi_app(webapp.WSGIApplication([ ('.*', Index), ]))
| ajibawa-2023/Python-Code-Large/train/row_1160 | 7 | 16 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1160:ImportFrom_L4_C0", "label": "from google.appengine.ext import webapp", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.25, 0.0625, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["webapp"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import webapp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:ImportFrom_L5_C0", "label": "from google.appengine.ext.webapp.util import run_wsgi_app", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.3125, 0.0625, 0, 0.66, 0.3333, 327, 0, 1, 0, 0, 327, 0, 0], "semantic": {"name": "google.appengine.ext.webapp.util", "arg_names": [], "import_names": ["run_wsgi_app"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp.util import run_wsgi_app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:ClassDef_L8_C0", "label": "Index", "type": "class", "loc": [8, 11], "level": 0, "parent": null, "vector": [3, 0, 0.5938, 0.25, 0, 0.66, 0.6667, 79, 0, 1, 0, 0, 256, 0, 1], "semantic": {"name": "Index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Index(webapp.RequestHandler):\n\n def get(self):\n self.redirect('%s/index.html' % self.request.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:FunctionDef_L10_C4", "label": "get", "type": "function", "loc": [10, 11], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1160:ClassDef_L8_C0", "vector": [2, 1, 0.6562, 0.125, 1, 0.96, 0.0, 607, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "get", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get(self):\n self.redirect('%s/index.html' % self.request.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:Expr_L11_C8", "label": "redirect()", "type": "expression", "loc": [11, 11], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1160:FunctionDef_L10_C4", "vector": [8, 2, 0.6875, 0.0625, 2, 0.46, 0.0, 206, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "redirect", "arg_names": [], "import_names": [], "rhs_call_name": "redirect", "annotation": ""}, "snippet": " self.redirect('%s/index.html' % self.request.path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:If_L14_C0", "label": "if", "type": "if", "loc": [14, 15], "level": 0, "parent": null, "vector": [4, 0, 0.9062, 0.125, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == \"__main__\":\n run_wsgi_app(webapp.WSGIApplication([ ('.*', Index), ]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1160:Expr_L15_C4", "label": "run_wsgi_app()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1160:If_L14_C0", "vector": [8, 1, 0.9375, 0.0625, 1, 0.78, 0.0, 563, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " run_wsgi_app(webapp.WSGIApplication([ ('.*', Index), ]))"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1160:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1160:FunctionDef_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1160:FunctionDef_L10_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1160:Expr_L11_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1160:If_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1160:Expr_L15_C4"}] |
'''
Module which brings history information about files from Mercurial.
@author: Rodrigo Damazio
'''
import re
import subprocess
REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')
def _GetOutputLines(args):
'''
Runs an external process and returns its output as a list of lines.
@param args: the arguments to run
'''
process = subprocess.Popen(args,
stdout=subprocess.PIPE,
universal_newlines = True,
shell = False)
output = process.communicate()[0]
return output.splitlines()
def FillMercurialRevisions(filename, parsed_file):
'''
Fills the revs attribute of all strings in the given parsed file with
a list of revisions that touched the lines corresponding to that string.
@param filename: the name of the file to get history for
@param parsed_file: the parsed file to modify
'''
# Take output of hg annotate to get revision of each line
output_lines = _GetOutputLines(['hg', 'annotate', '-c', filename])
# Create a map of line -> revision (key is list index, line 0 doesn't exist)
line_revs = ['dummy']
for line in output_lines:
rev_match = REVISION_REGEX.match(line)
if not rev_match:
raise 'Unexpected line of output from hg: %s' % line
rev_hash = rev_match.group('hash')
line_revs.append(rev_hash)
for str in parsed_file.itervalues():
# Get the lines that correspond to each string
start_line = str['startLine']
end_line = str['endLine']
# Get the revisions that touched those lines
revs = []
for line_number in range(start_line, end_line + 1):
revs.append(line_revs[line_number])
# Merge with any revisions that were already there
# (for explict revision specification)
if 'revs' in str:
revs += str['revs']
# Assign the revisions to the string
str['revs'] = frozenset(revs)
def DoesRevisionSuperceed(filename, rev1, rev2):
'''
Tells whether a revision superceeds another.
This essentially means that the older revision is an ancestor of the newer
one.
This also returns True if the two revisions are the same.
@param rev1: the revision that may be superceeding the other
@param rev2: the revision that may be superceeded
@return: True if rev1 superceeds rev2 or they're the same
'''
if rev1 == rev2:
return True
# TODO: Add filename
args = ['hg', 'log', '-r', 'ancestors(%s)' % rev1, '--template', '{node|short}\n', filename]
output_lines = _GetOutputLines(args)
return rev2 in output_lines
def NewestRevision(filename, rev1, rev2):
'''
Returns which of two revisions is closest to the head of the repository.
If none of them is the ancestor of the other, then we return either one.
@param rev1: the first revision
@param rev2: the second revision
'''
if DoesRevisionSuperceed(filename, rev1, rev2):
return rev1
return rev2 | ajibawa-2023/Python-Code-Large/train/row_1161 | 38 | 94 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0319, 0.0532, 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 which brings history information about files from Mercurial.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Import_L7_C0", "label": "re import re", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0745, 0.0106, 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_1161:Import_L8_C0", "label": "subprocess import subprocess", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0851, 0.0106, 0, 0.66, 0.2857, 394, 0, 1, 0, 0, 394, 0, 0], "semantic": {"name": "subprocess", "arg_names": [], "import_names": ["subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import subprocess"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L10_C0", "label": "REVISION_REGEX = compile()", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.1064, 0.0106, 0, 0.66, 0.4286, 883, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "REVISION_REGEX", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "REVISION_REGEX = re.compile(r'(?P<hash>[0-9a-f]{12}):.*')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "label": "_GetOutputLines", "type": "function", "loc": [12, 23], "level": 0, "parent": null, "vector": [2, 0, 0.1862, 0.1277, 0, 0.66, 0.5714, 359, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "_GetOutputLines", "arg_names": ["args"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _GetOutputLines(args):\n '''\n Runs an external process and returns its output as a list of lines.\n\n @param args: the arguments to run\n '''\n process = subprocess.Popen(args,\n stdout=subprocess.PIPE,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L13_C2", "label": "expression", "type": "expression", "loc": [13, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "vector": [8, 1, 0.1596, 0.0532, 1, 0.48, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Runs an external process and returns its output as a list of lines.\n\n @param args: the arguments to run\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L18_C2", "label": "process = Popen()", "type": "assigned_variable", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "vector": [14, 1, 0.2074, 0.0426, 1, 0.48, 0.3333, 712, 3, 4, 0, 0, 568, 10, 1], "semantic": {"name": "process", "arg_names": [], "import_names": [], "rhs_call_name": "Popen", "annotation": ""}, "snippet": " process = subprocess.Popen(args,\n stdout=subprocess.PIPE,\n universal_newlines = True,\n shell = False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L22_C2", "label": "output =", "type": "assigned_variable", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "vector": [14, 1, 0.234, 0.0106, 1, 0.48, 0.6667, 886, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "output", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " output = process.communicate()[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L23_C2", "label": "return", "type": "return", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "vector": [13, 1, 0.2447, 0.0106, 1, 0.48, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return output.splitlines()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "label": "FillMercurialRevisions", "type": "function", "loc": [26, 62], "level": 0, "parent": null, "vector": [2, 0, 0.4681, 0.3936, 0, 0.66, 0.7143, 942, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "FillMercurialRevisions", "arg_names": ["filename", "parsed_file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def FillMercurialRevisions(filename, parsed_file):\n '''\n Fills the revs attribute of all strings in the given parsed file with\n a list of revisions that touched the lines corresponding to that string.\n \n @param filename: the name of the file to get history for\n @param parsed_file: the parsed file to modify\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L27_C2", "label": "expression", "type": "expression", "loc": [27, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "vector": [8, 1, 0.3191, 0.0745, 1, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Fills the revs attribute of all strings in the given parsed file with\n a list of revisions that touched the lines corresponding to that string.\n \n @param filename: the name of the file to get history for\n @param parsed_file: the parsed file to modify\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L35_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "vector": [14, 1, 0.3723, 0.0106, 1, 0.17, 0.25, 574, 3, 1, 0, 0, 359, 10, 1], "semantic": {"name": "output_lines", "arg_names": [], "import_names": [], "rhs_call_name": "_GetOutputLines", "annotation": ""}, "snippet": " output_lines = _GetOutputLines(['hg', 'annotate', '-c', filename])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L38_C2", "label": "line_revs =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "vector": [14, 1, 0.4043, 0.0106, 1, 0.17, 0.5, 348, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "line_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line_revs = ['dummy']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "label": "for line", "type": "for", "loc": [39, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "vector": [6, 1, 0.4415, 0.0638, 1, 0.17, 0.75, 373, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in output_lines:\n rev_match = REVISION_REGEX.match(line)\n if not rev_match:\n raise 'Unexpected line of output from hg: %s' % line\n rev_hash = rev_match.group('hash')\n line_revs.append(rev_hash)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L40_C4", "label": "rev_match = match()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "vector": [14, 2, 0.4255, 0.0106, 2, 0.91, 0.0, 931, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "rev_match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " rev_match = REVISION_REGEX.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L41_C4", "label": "if", "type": "if", "loc": [41, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "vector": [4, 2, 0.4415, 0.0213, 2, 0.91, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not rev_match:\n raise 'Unexpected line of output from hg: %s' % line"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L43_C4", "label": "rev_hash = group()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "vector": [14, 2, 0.4574, 0.0106, 2, 0.91, 0.6667, 682, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "rev_hash", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " rev_hash = rev_match.group('hash')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L44_C4", "label": "append()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "vector": [8, 2, 0.4681, 0.0106, 2, 0.91, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " line_revs.append(rev_hash)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "label": "for str", "type": "for", "loc": [46, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "vector": [6, 1, 0.5745, 0.1809, 1, 0.17, 1.0, 52, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for str in parsed_file.itervalues():\n # Get the lines that correspond to each string\n start_line = str['startLine']\n end_line = str['endLine']\n\n # Get the revisions that touched those lines\n revs = []\n for line_number in range(start_line, end_line + 1):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L48_C4", "label": "start_line =", "type": "assigned_variable", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [14, 2, 0.5106, 0.0106, 2, 0.24, 0.0, 501, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "start_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " start_line = str['startLine']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L49_C4", "label": "end_line =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [14, 2, 0.5213, 0.0106, 2, 0.24, 0.2, 54, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "end_line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " end_line = str['endLine']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L52_C4", "label": "revs =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [14, 2, 0.5532, 0.0106, 2, 0.24, 0.4, 848, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " revs = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L53_C4", "label": "for line_number", "type": "for", "loc": [53, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [6, 2, 0.5691, 0.0213, 2, 0.24, 0.6, 490, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line_number", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line_number in range(start_line, end_line + 1):\n revs.append(line_revs[line_number])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L54_C6", "label": "append()", "type": "expression", "loc": [54, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L53_C4", "vector": [8, 3, 0.5745, 0.0106, 3, 0.92, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " revs.append(line_revs[line_number])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [4, 2, 0.6223, 0.0213, 2, 0.24, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'revs' in str:\n revs += str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L62_C4", "label": " = frozenset()", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "vector": [14, 2, 0.6596, 0.0106, 2, 0.24, 1.0, 0, 3, 1, 0, 0, 80, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " str['revs'] = frozenset(revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "label": "DoesRevisionSuperceed", "type": "function", "loc": [64, 82], "level": 0, "parent": null, "vector": [2, 0, 0.7766, 0.2021, 0, 0.66, 0.8571, 330, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "DoesRevisionSuperceed", "arg_names": ["filename", "rev1", "rev2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DoesRevisionSuperceed(filename, rev1, rev2):\n '''\n Tells whether a revision superceeds another.\n This essentially means that the older revision is an ancestor of the newer\n one.\n This also returns True if the two revisions are the same.\n\n @param rev1: the revision that may be superceeding the other"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L65_C2", "label": "expression", "type": "expression", "loc": [65, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "vector": [8, 1, 0.7394, 0.1064, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Tells whether a revision superceeds another.\n This essentially means that the older revision is an ancestor of the newer\n one.\n This also returns True if the two revisions are the same.\n\n @param rev1: the revision that may be superceeding the other\n @param rev2: the revision that may be superceeded"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L75_C2", "label": "if", "type": "if", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "vector": [4, 1, 0.8032, 0.0213, 1, 0.74, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev1 == rev2:\n return True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L76_C4", "label": "return", "type": "return", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L75_C2", "vector": [13, 2, 0.8085, 0.0106, 2, 0.6, 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_1161:Assign_L79_C2", "label": "args =", "type": "assigned_variable", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "vector": [14, 1, 0.8404, 0.0106, 1, 0.74, 0.5, 805, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "args", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " args = ['hg', 'log', '-r', 'ancestors(%s)' % rev1, '--template', '{node|short}\\n', filename]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L80_C2", "label": "output_lines = _GetOutputLines()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "vector": [14, 1, 0.8511, 0.0106, 1, 0.74, 0.75, 574, 3, 1, 0, 0, 359, 10, 1], "semantic": {"name": "output_lines", "arg_names": [], "import_names": [], "rhs_call_name": "_GetOutputLines", "annotation": ""}, "snippet": " output_lines = _GetOutputLines(args)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "vector": [13, 1, 0.8723, 0.0106, 1, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev2 in output_lines"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "label": "NewestRevision", "type": "function", "loc": [84, 94], "level": 0, "parent": null, "vector": [2, 0, 0.9468, 0.117, 0, 0.66, 1.0, 256, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "NewestRevision", "arg_names": ["filename", "rev1", "rev2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def NewestRevision(filename, rev1, rev2):\n '''\n Returns which of two revisions is closest to the head of the repository.\n If none of them is the ancestor of the other, then we return either one.\n\n @param rev1: the first revision\n @param rev2: the second revision\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L85_C2", "label": "expression", "type": "expression", "loc": [85, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "vector": [8, 1, 0.9362, 0.0745, 1, 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 which of two revisions is closest to the head of the repository.\n If none of them is the ancestor of the other, then we return either one.\n\n @param rev1: the first revision\n @param rev2: the second revision\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L92_C2", "label": "if", "type": "if", "loc": [92, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "vector": [4, 1, 0.984, 0.0213, 1, 0.13, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if DoesRevisionSuperceed(filename, rev1, rev2):\n return rev1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L93_C4", "label": "return", "type": "return", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L92_C2", "vector": [13, 2, 0.9894, 0.0106, 2, 0.59, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L94_C2", "label": "return", "type": "return", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "vector": [13, 1, 1.0, 0.0106, 1, 0.13, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rev2"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L53_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L54_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:If_L92_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1161:FunctionDef_L84_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1161:Return_L94_C2"}] |
#!/usr/bin/python
'''
Entry point for My Tracks i18n tool.
@author: Rodrigo Damazio
'''
import mytracks.files
import mytracks.translate
import mytracks.validate
import sys
def Usage():
print 'Usage: %s <command> [<language> ...]\n' % sys.argv[0]
print 'Commands are:'
print ' cleanup'
print ' translate'
print ' validate'
sys.exit(1)
def Translate(languages):
'''
Asks the user to interactively translate any missing or oudated strings from
the files for the given languages.
@param languages: the languages to translate
'''
validator = mytracks.validate.Validator(languages)
validator.Validate()
missing = validator.missing_in_lang()
outdated = validator.outdated_in_lang()
for lang in languages:
untranslated = missing[lang] + outdated[lang]
if len(untranslated) == 0:
continue
translator = mytracks.translate.Translator(lang)
translator.Translate(untranslated)
def Validate(languages):
'''
Computes and displays errors in the string files for the given languages.
@param languages: the languages to compute for
'''
validator = mytracks.validate.Validator(languages)
validator.Validate()
error_count = 0
if (validator.valid()):
print 'All files OK'
else:
for lang, missing in validator.missing_in_master().iteritems():
print 'Missing in master, present in %s: %s:' % (lang, str(missing))
error_count = error_count + len(missing)
for lang, missing in validator.missing_in_lang().iteritems():
print 'Missing in %s, present in master: %s:' % (lang, str(missing))
error_count = error_count + len(missing)
for lang, outdated in validator.outdated_in_lang().iteritems():
print 'Outdated in %s: %s:' % (lang, str(outdated))
error_count = error_count + len(outdated)
return error_count
if __name__ == '__main__':
argv = sys.argv
argc = len(argv)
if argc < 2:
Usage()
languages = mytracks.files.GetAllLanguageFiles()
if argc == 3:
langs = set(argv[2:])
if not langs.issubset(languages):
raise 'Language(s) not found'
# Filter just to the languages specified
languages = dict((lang, lang_file)
for lang, lang_file in languages.iteritems()
if lang in langs or lang == 'en' )
cmd = argv[1]
if cmd == 'translate':
Translate(languages)
elif cmd == 'validate':
error_count = Validate(languages)
else:
Usage()
error_count = 0
print '%d errors found.' % error_count
| ajibawa-2023/Python-Code-Large/train/row_1162 | 58 | 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_1162:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0521, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "'''\nEntry point for My Tracks i18n tool.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Import_L8_C0", "label": "mytracks.files import mytracks.files", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0833, 0.0104, 0, 0.66, 0.125, 640, 0, 1, 0, 0, 640, 0, 0], "semantic": {"name": "mytracks.files", "arg_names": [], "import_names": ["mytracks.files"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.files"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Import_L9_C0", "label": "mytracks.translate import mytracks.translate", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0938, 0.0104, 0, 0.66, 0.25, 802, 0, 1, 0, 0, 802, 0, 0], "semantic": {"name": "mytracks.translate", "arg_names": [], "import_names": ["mytracks.translate"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.translate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Import_L10_C0", "label": "mytracks.validate import mytracks.validate", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.1042, 0.0104, 0, 0.66, 0.375, 355, 0, 1, 0, 0, 355, 0, 0], "semantic": {"name": "mytracks.validate", "arg_names": [], "import_names": ["mytracks.validate"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.validate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Import_L11_C0", "label": "sys import sys", "type": "import", "loc": [11, 11], "level": 0, "parent": null, "vector": [1, 0, 0.1146, 0.0104, 0, 0.66, 0.5, 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_1162:FunctionDef_L13_C0", "label": "Usage", "type": "function", "loc": [13, 19], "level": 0, "parent": null, "vector": [2, 0, 0.1667, 0.0729, 0, 0.66, 0.625, 208, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Usage():\n print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])\n print('Commands are:')\n print(' cleanup')\n print(' translate')\n print(' validate')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L14_C2", "label": "print()", "type": "expression", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1458, 0.0104, 1, 0.21, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Usage: %s <command> [<language> ...]\\n' % sys.argv[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L15_C2", "label": "print()", "type": "expression", "loc": [15, 15], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1562, 0.0104, 1, 0.21, 0.2, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Commands are:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L16_C2", "label": "print()", "type": "expression", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1667, 0.0104, 1, 0.21, 0.4, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' cleanup')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L17_C2", "label": "print()", "type": "expression", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1771, 0.0104, 1, 0.21, 0.6, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' translate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L18_C2", "label": "print()", "type": "expression", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1875, 0.0104, 1, 0.21, 0.8, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' validate')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L19_C2", "label": "exit()", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "vector": [8, 1, 0.1979, 0.0104, 1, 0.21, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "label": "Translate", "type": "function", "loc": [22, 41], "level": 0, "parent": null, "vector": [2, 0, 0.3281, 0.2083, 0, 0.66, 0.75, 749, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "Translate", "arg_names": ["languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Translate(languages):\n '''\n Asks the user to interactively translate any missing or oudated strings from\n the files for the given languages.\n\n @param languages: the languages to translate\n '''\n validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [8, 1, 0.2656, 0.0625, 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 Asks the user to interactively translate any missing or oudated strings from\n the files for the given languages.\n\n @param languages: the languages to translate\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L29_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [14, 1, 0.3021, 0.0104, 1, 0.93, 0.2, 145, 3, 1, 0, 0, 957, 10, 1], "semantic": {"name": "validator", "arg_names": [], "import_names": [], "rhs_call_name": "Validator", "annotation": ""}, "snippet": " validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L30_C2", "label": "Validate()", "type": "expression", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [8, 1, 0.3125, 0.0104, 1, 0.93, 0.4, 60, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Validate", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L31_C2", "label": "missing = missing_in_lang()", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [14, 1, 0.3229, 0.0104, 1, 0.93, 0.6, 249, 3, 0, 0, 0, 449, 10, 1], "semantic": {"name": "missing", "arg_names": [], "import_names": [], "rhs_call_name": "missing_in_lang", "annotation": ""}, "snippet": " missing = validator.missing_in_lang()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L32_C2", "label": "outdated = outdated_in_lang()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [14, 1, 0.3333, 0.0104, 1, 0.93, 0.8, 362, 3, 0, 0, 0, 862, 10, 1], "semantic": {"name": "outdated", "arg_names": [], "import_names": [], "rhs_call_name": "outdated_in_lang", "annotation": ""}, "snippet": " outdated = validator.outdated_in_lang()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "label": "for lang", "type": "for", "loc": [34, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "vector": [6, 1, 0.3906, 0.0833, 1, 0.93, 1.0, 312, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang in languages:\n untranslated = missing[lang] + outdated[lang]\n \n if len(untranslated) == 0:\n continue\n\n translator = mytracks.translate.Translator(lang)\n translator.Translate(untranslated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L35_C4", "label": "untranslated =", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "vector": [14, 2, 0.3646, 0.0104, 2, 0.22, 0.0, 493, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "untranslated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " untranslated = missing[lang] + outdated[lang]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L37_C4", "label": "if", "type": "if", "loc": [37, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "vector": [4, 2, 0.3906, 0.0208, 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 len(untranslated) == 0:\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L40_C4", "label": "translator = Translator()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "vector": [14, 2, 0.4167, 0.0104, 2, 0.22, 0.6667, 380, 3, 1, 0, 0, 229, 10, 1], "semantic": {"name": "translator", "arg_names": [], "import_names": [], "rhs_call_name": "Translator", "annotation": ""}, "snippet": " translator = mytracks.translate.Translator(lang)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L41_C4", "label": "Translate()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "vector": [8, 2, 0.4271, 0.0104, 2, 0.22, 1.0, 749, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": [], "import_names": [], "rhs_call_name": "Translate", "annotation": ""}, "snippet": " translator.Translate(untranslated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "label": "Validate", "type": "function", "loc": [44, 67], "level": 0, "parent": null, "vector": [2, 0, 0.5781, 0.25, 0, 0.66, 0.875, 60, 0, 1, 1, 0, 0, 0, 19], "semantic": {"name": "Validate", "arg_names": ["languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Validate(languages):\n '''\n Computes and displays errors in the string files for the given languages.\n\n @param languages: the languages to compute for\n '''\n validator = mytracks.validate.Validator(languages)\n validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [8, 1, 0.4896, 0.0521, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computes and displays errors in the string files for the given languages.\n\n @param languages: the languages to compute for\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L50_C2", "label": "validator = Validator()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [14, 1, 0.5208, 0.0104, 1, 0.65, 0.2, 145, 3, 1, 0, 0, 957, 10, 1], "semantic": {"name": "validator", "arg_names": [], "import_names": [], "rhs_call_name": "Validator", "annotation": ""}, "snippet": " validator = mytracks.validate.Validator(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L51_C2", "label": "Validate()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [8, 1, 0.5312, 0.0104, 1, 0.65, 0.4, 60, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Validate", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " validator.Validate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L53_C2", "label": "error_count =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.65, 0.6, 59, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "label": "if", "type": "if", "loc": [54, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [4, 1, 0.6198, 0.125, 1, 0.65, 0.8, 0, 3, 0, 0, 0, 0, 0, 17], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (validator.valid()):\n print('All files OK')\n else:\n for lang, missing in validator.missing_in_master().iteritems():\n print('Missing in master, present in %s: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)\n for lang, missing in validator.missing_in_lang().iteritems():\n print('Missing in %s, present in master: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L55_C4", "label": "print()", "type": "expression", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "vector": [8, 2, 0.5729, 0.0104, 2, 0.1, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('All files OK')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4", "label": "for lang, missing", "type": "for", "loc": [57, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "vector": [6, 2, 0.6042, 0.0312, 2, 0.1, 0.3333, 399, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, missing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, missing in validator.missing_in_master().iteritems():\n print('Missing in master, present in %s: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L58_C6", "label": "print()", "type": "expression", "loc": [58, 58], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4", "vector": [8, 3, 0.6042, 0.0104, 3, 0.69, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Missing in master, present in %s: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L59_C6", "label": "error_count =", "type": "assigned_variable", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4", "vector": [14, 3, 0.6146, 0.0104, 3, 0.69, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4", "label": "for lang, missing", "type": "for", "loc": [60, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "vector": [6, 2, 0.6354, 0.0312, 2, 0.1, 0.6667, 399, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, missing", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, missing in validator.missing_in_lang().iteritems():\n print('Missing in %s, present in master: %s:' % (lang, str(missing)))\n error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L61_C6", "label": "print()", "type": "expression", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4", "vector": [8, 3, 0.6354, 0.0104, 3, 0.79, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Missing in %s, present in master: %s:' % (lang, str(missing)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L62_C6", "label": "error_count =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4", "vector": [14, 3, 0.6458, 0.0104, 3, 0.79, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(missing)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4", "label": "for lang, outdated", "type": "for", "loc": [63, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "vector": [6, 2, 0.6667, 0.0312, 2, 0.1, 1.0, 928, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, outdated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, outdated in validator.outdated_in_lang().iteritems():\n print('Outdated in %s: %s:' % (lang, str(outdated)))\n error_count = error_count + len(outdated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L64_C6", "label": "print()", "type": "expression", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4", "vector": [8, 3, 0.6667, 0.0104, 3, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Outdated in %s: %s:' % (lang, str(outdated)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L65_C6", "label": "error_count =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4", "vector": [14, 3, 0.6771, 0.0104, 3, 0.01, 1.0, 59, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = error_count + len(outdated)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "vector": [13, 1, 0.6979, 0.0104, 1, 0.65, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return error_count"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "label": "if", "type": "if", "loc": [70, 96], "level": 0, "parent": null, "vector": [4, 0, 0.8646, 0.2812, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n argv = sys.argv\n argc = len(argv)\n if argc < 2:\n Usage()\n\n languages = mytracks.files.GetAllLanguageFiles()\n if argc == 3:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L71_C2", "label": "argv =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [14, 1, 0.7396, 0.0104, 1, 0.25, 0.0, 612, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "argv", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " argv = sys.argv"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L72_C2", "label": "argc = len()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [14, 1, 0.75, 0.0104, 1, 0.25, 0.1429, 123, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "argc", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " argc = len(argv)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L73_C2", "label": "if", "type": "if", "loc": [73, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [4, 1, 0.7656, 0.0208, 1, 0.25, 0.2857, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argc < 2:\n Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L74_C4", "label": "Usage()", "type": "expression", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L73_C2", "vector": [8, 2, 0.7708, 0.0104, 2, 0.66, 0.0, 208, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "Usage", "annotation": ""}, "snippet": " Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L76_C2", "label": "languages = GetAllLanguageFiles()", "type": "assigned_variable", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [14, 1, 0.7917, 0.0104, 1, 0.25, 0.4286, 126, 3, 0, 0, 0, 438, 10, 1], "semantic": {"name": "languages", "arg_names": [], "import_names": [], "rhs_call_name": "GetAllLanguageFiles", "annotation": ""}, "snippet": " languages = mytracks.files.GetAllLanguageFiles()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "label": "if", "type": "if", "loc": [77, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [4, 1, 0.8438, 0.0938, 1, 0.25, 0.5714, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if argc == 3:\n langs = set(argv[2:])\n if not langs.issubset(languages):\n raise 'Language(s) not found'\n\n # Filter just to the languages specified\n languages = dict((lang, lang_file)\n for lang, lang_file in languages.iteritems()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L78_C4", "label": "langs = set()", "type": "assigned_variable", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "vector": [14, 2, 0.8125, 0.0104, 2, 0.01, 0.0, 986, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "langs", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " langs = set(argv[2:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L79_C4", "label": "if", "type": "if", "loc": [79, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "vector": [4, 2, 0.8281, 0.0208, 2, 0.01, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not langs.issubset(languages):\n raise 'Language(s) not found'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L83_C4", "label": "languages = dict()", "type": "assigned_variable", "loc": [83, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "vector": [14, 2, 0.875, 0.0312, 2, 0.01, 1.0, 126, 3, 1, 0, 0, 827, 10, 2], "semantic": {"name": "languages", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " languages = dict((lang, lang_file)\n for lang, lang_file in languages.iteritems()\n if lang in langs or lang == 'en' )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L87_C2", "label": "cmd =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [14, 1, 0.9062, 0.0104, 1, 0.25, 0.7143, 604, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [4, 1, 0.9479, 0.0729, 1, 0.25, 0.8571, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if cmd == 'translate':\n Translate(languages)\n elif cmd == 'validate':\n error_count = Validate(languages)\n else:\n Usage()\n error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L89_C4", "label": "Translate()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.02, 0.0, 749, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": [], "import_names": [], "rhs_call_name": "Translate", "annotation": ""}, "snippet": " Translate(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2", "vector": [4, 2, 0.9583, 0.0521, 2, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif cmd == 'validate':\n error_count = Validate(languages)\n else:\n Usage()\n error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L91_C4", "label": "error_count = Validate()", "type": "assigned_variable", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "vector": [14, 3, 0.9479, 0.0104, 3, 0.77, 0.0, 59, 3, 1, 0, 0, 60, 10, 1], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "Validate", "annotation": ""}, "snippet": " error_count = Validate(languages)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L93_C4", "label": "Usage()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "vector": [8, 3, 0.9688, 0.0104, 3, 0.77, 0.5, 208, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "Usage", "arg_names": [], "import_names": [], "rhs_call_name": "Usage", "annotation": ""}, "snippet": " Usage()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L94_C4", "label": "error_count =", "type": "assigned_variable", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "vector": [14, 3, 0.9792, 0.0104, 3, 0.77, 1.0, 59, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "error_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " error_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L96_C2", "label": "print()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "vector": [8, 1, 1.0, 0.0104, 1, 0.25, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%d errors found.' % error_count)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L15_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L58_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:For_L63_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:FunctionDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L73_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Assign_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1162:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1162:Expr_L96_C2"}] |
'''
Module which prompts the user for translations and saves them.
TODO: implement
@author: Rodrigo Damazio
'''
class Translator(object):
'''
classdocs
'''
def __init__(self, language):
'''
Constructor
'''
self._language = language
def Translate(self, string_names):
print string_names | ajibawa-2023/Python-Code-Large/train/row_1163 | 8 | 21 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.1905, 0.3333, 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 which prompts the user for translations and saves them.\n\nTODO: implement\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "label": "Translator", "type": "class", "loc": [9, 21], "level": 0, "parent": null, "vector": [3, 0, 0.7143, 0.619, 0, 0.66, 1.0, 229, 0, 2, 0, 0, 186, 0, 1], "semantic": {"name": "Translator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Translator(object):\n '''\n classdocs\n '''\n\n def __init__(self, language):\n '''\n Constructor"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L10_C2", "label": "expression", "type": "expression", "loc": [10, 12], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "vector": [8, 1, 0.5238, 0.1429, 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 classdocs\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "vector": [2, 1, 0.7619, 0.2381, 1, 0.33, 0.5, 555, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "__init__", "arg_names": ["self", "language"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, language):\n '''\n Constructor\n '''\n self._language = language"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2", "vector": [8, 2, 0.7619, 0.1429, 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 Constructor\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:Assign_L18_C4", "label": "self._language =", "type": "assigned_variable", "loc": [18, 18], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2", "vector": [14, 2, 0.8571, 0.0476, 2, 0.54, 1.0, 494, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._language", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._language = language"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L20_C2", "label": "Translate", "type": "function", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "vector": [2, 1, 0.9762, 0.0952, 1, 0.33, 1.0, 749, 0, 2, 0, 0, 0, 0, 1], "semantic": {"name": "Translate", "arg_names": ["self", "string_names"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Translate(self, string_names):\n print(string_names)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L21_C4", "label": "print()", "type": "expression", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L20_C2", "vector": [8, 2, 1.0, 0.0476, 2, 0.59, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(string_names)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L10_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1163:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1163:FunctionDef_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1163:Expr_L21_C4"}] |
'''
Module which compares languague files to the master file and detects
issues.
@author: Rodrigo Damazio
'''
import os
from mytracks.parser import StringsParser
import mytracks.history
class Validator(object):
def __init__(self, languages):
'''
Builds a strings file validator.
Params:
@param languages: a dictionary mapping each language to its corresponding directory
'''
self._langs = {}
self._master = None
self._language_paths = languages
parser = StringsParser()
for lang, lang_dir in languages.iteritems():
filename = os.path.join(lang_dir, 'strings.xml')
parsed_file = parser.Parse(filename)
mytracks.history.FillMercurialRevisions(filename, parsed_file)
if lang == 'en':
self._master = parsed_file
else:
self._langs[lang] = parsed_file
self._Reset()
def Validate(self):
'''
Computes whether all the data in the files for the given languages is valid.
'''
self._Reset()
self._ValidateMissingKeys()
self._ValidateOutdatedKeys()
def valid(self):
return (len(self._missing_in_master) == 0 and
len(self._missing_in_lang) == 0 and
len(self._outdated_in_lang) == 0)
def missing_in_master(self):
return self._missing_in_master
def missing_in_lang(self):
return self._missing_in_lang
def outdated_in_lang(self):
return self._outdated_in_lang
def _Reset(self):
# These are maps from language to string name list
self._missing_in_master = {}
self._missing_in_lang = {}
self._outdated_in_lang = {}
def _ValidateMissingKeys(self):
'''
Computes whether there are missing keys on either side.
'''
master_keys = frozenset(self._master.iterkeys())
for lang, file in self._langs.iteritems():
keys = frozenset(file.iterkeys())
missing_in_master = keys - master_keys
missing_in_lang = master_keys - keys
if len(missing_in_master) > 0:
self._missing_in_master[lang] = missing_in_master
if len(missing_in_lang) > 0:
self._missing_in_lang[lang] = missing_in_lang
def _ValidateOutdatedKeys(self):
'''
Computers whether any of the language keys are outdated with relation to the
master keys.
'''
for lang, file in self._langs.iteritems():
outdated = []
for key, str in file.iteritems():
# Get all revisions that touched master and language files for this
# string.
master_str = self._master[key]
master_revs = master_str['revs']
lang_revs = str['revs']
if not master_revs or not lang_revs:
print 'WARNING: No revision for %s in %s' % (key, lang)
continue
master_file = os.path.join(self._language_paths['en'], 'strings.xml')
lang_file = os.path.join(self._language_paths[lang], 'strings.xml')
# Assume that the repository has a single head (TODO: check that),
# and as such there is always one revision which superceeds all others.
master_rev = reduce(
lambda r1, r2: mytracks.history.NewestRevision(master_file, r1, r2),
master_revs)
lang_rev = reduce(
lambda r1, r2: mytracks.history.NewestRevision(lang_file, r1, r2),
lang_revs)
# If the master version is newer than the lang version
if mytracks.history.DoesRevisionSuperceed(lang_file, master_rev, lang_rev):
outdated.append(key)
if len(outdated) > 0:
self._outdated_in_lang[lang] = outdated
| ajibawa-2023/Python-Code-Large/train/row_1164 | 65 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0304, 0.0522, 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 which compares languague files to the master file and detects\nissues.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Import_L8_C0", "label": "os import os", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0696, 0.0087, 0, 0.66, 0.25, 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_1164:ImportFrom_L9_C0", "label": "from mytracks.parser import StringsParser", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.0783, 0.0087, 0, 0.66, 0.5, 161, 0, 1, 0, 0, 161, 0, 0], "semantic": {"name": "mytracks.parser", "arg_names": [], "import_names": ["StringsParser"], "rhs_call_name": "", "annotation": ""}, "snippet": "from mytracks.parser import StringsParser"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Import_L10_C0", "label": "mytracks.history import mytracks.history", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.087, 0.0087, 0, 0.66, 0.75, 247, 0, 1, 0, 0, 247, 0, 0], "semantic": {"name": "mytracks.history", "arg_names": [], "import_names": ["mytracks.history"], "rhs_call_name": "", "annotation": ""}, "snippet": "import mytracks.history "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "label": "Validator", "type": "class", "loc": [12, 115], "level": 0, "parent": null, "vector": [3, 0, 0.5522, 0.9043, 0, 0.66, 1.0, 957, 0, 9, 0, 0, 186, 0, 31], "semantic": {"name": "Validator", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class Validator(object):\n\n def __init__(self, languages):\n '''\n Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "label": "__init__", "type": "function", "loc": [14, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.2174, 0.2, 1, 0.74, 0.0, 555, 0, 2, 0, 0, 0, 0, 6], "semantic": {"name": "__init__", "arg_names": ["self", "languages"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, languages):\n '''\n Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory\n '''\n self._langs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L15_C4", "label": "expression", "type": "expression", "loc": [15, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [8, 2, 0.1522, 0.0522, 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 Builds a strings file validator.\n \n Params:\n @param languages: a dictionary mapping each language to its corresponding directory\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L21_C4", "label": "self._langs =", "type": "assigned_variable", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [14, 2, 0.1826, 0.0087, 2, 0.94, 0.1667, 591, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._langs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._langs = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L22_C4", "label": "self._master =", "type": "assigned_variable", "loc": [22, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [14, 2, 0.1913, 0.0087, 2, 0.94, 0.3333, 265, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._master = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L23_C4", "label": "self._language_paths =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [14, 2, 0.2, 0.0087, 2, 0.94, 0.5, 356, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._language_paths", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._language_paths = languages"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L25_C4", "label": "parser = StringsParser()", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [14, 2, 0.2174, 0.0087, 2, 0.94, 0.6667, 968, 3, 0, 0, 0, 282, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "StringsParser", "annotation": ""}, "snippet": " parser = StringsParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "label": "for lang, lang_dir", "type": "for", "loc": [26, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [6, 2, 0.2609, 0.0783, 2, 0.94, 0.8333, 114, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "lang, lang_dir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, lang_dir in languages.iteritems():\n filename = os.path.join(lang_dir, 'strings.xml')\n parsed_file = parser.Parse(filename)\n mytracks.history.FillMercurialRevisions(filename, parsed_file)\n\n if lang == 'en':\n self._master = parsed_file\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L27_C6", "label": "filename = join()", "type": "assigned_variable", "loc": [27, 27], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "vector": [14, 3, 0.2348, 0.0087, 3, 0.65, 0.0, 275, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " filename = os.path.join(lang_dir, 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L28_C6", "label": "parsed_file = Parse()", "type": "assigned_variable", "loc": [28, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "vector": [14, 3, 0.2435, 0.0087, 3, 0.65, 0.3333, 76, 3, 1, 0, 0, 291, 10, 1], "semantic": {"name": "parsed_file", "arg_names": [], "import_names": [], "rhs_call_name": "Parse", "annotation": ""}, "snippet": " parsed_file = parser.Parse(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L29_C6", "label": "FillMercurialRevisions()", "type": "expression", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "vector": [8, 3, 0.2522, 0.0087, 3, 0.65, 0.6667, 942, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "FillMercurialRevisions", "arg_names": [], "import_names": [], "rhs_call_name": "FillMercurialRevisions", "annotation": ""}, "snippet": " mytracks.history.FillMercurialRevisions(filename, parsed_file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6", "label": "if", "type": "if", "loc": [31, 34], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "vector": [4, 3, 0.2826, 0.0348, 3, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lang == 'en':\n self._master = parsed_file\n else:\n self._langs[lang] = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L32_C8", "label": "self._master =", "type": "assigned_variable", "loc": [32, 32], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6", "vector": [14, 4, 0.2783, 0.0087, 4, 0.1, 0.0, 265, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._master = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L34_C8", "label": "assign", "type": "assigned_variable", "loc": [34, 34], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6", "vector": [14, 4, 0.2957, 0.0087, 4, 0.1, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._langs[lang] = parsed_file"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L36_C4", "label": "_Reset()", "type": "expression", "loc": [36, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "vector": [8, 2, 0.313, 0.0087, 2, 0.94, 1.0, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "label": "Validate", "type": "function", "loc": [38, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.3565, 0.0609, 1, 0.74, 0.125, 60, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "Validate", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Validate(self):\n '''\n Computes whether all the data in the files for the given languages is valid.\n '''\n self._Reset()\n self._ValidateMissingKeys()\n self._ValidateOutdatedKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L39_C4", "label": "expression", "type": "expression", "loc": [39, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "vector": [8, 2, 0.3478, 0.0261, 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 Computes whether all the data in the files for the given languages is valid.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L42_C4", "label": "_Reset()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "vector": [8, 2, 0.3652, 0.0087, 2, 0.03, 0.3333, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L43_C4", "label": "_ValidateMissingKeys()", "type": "expression", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "vector": [8, 2, 0.3739, 0.0087, 2, 0.03, 0.6667, 427, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_ValidateMissingKeys", "arg_names": [], "import_names": [], "rhs_call_name": "_ValidateMissingKeys", "annotation": ""}, "snippet": " self._ValidateMissingKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L44_C4", "label": "_ValidateOutdatedKeys()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "vector": [8, 2, 0.3826, 0.0087, 2, 0.03, 1.0, 676, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_ValidateOutdatedKeys", "arg_names": [], "import_names": [], "rhs_call_name": "_ValidateOutdatedKeys", "annotation": ""}, "snippet": " self._ValidateOutdatedKeys()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L46_C2", "label": "valid", "type": "function", "loc": [46, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.413, 0.0348, 1, 0.74, 0.25, 552, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "valid", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def valid(self):\n return (len(self._missing_in_master) == 0 and\n len(self._missing_in_lang) == 0 and\n len(self._outdated_in_lang) == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L47_C4", "label": "return", "type": "return", "loc": [47, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L46_C2", "vector": [13, 2, 0.4174, 0.0261, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (len(self._missing_in_master) == 0 and\n len(self._missing_in_lang) == 0 and\n len(self._outdated_in_lang) == 0)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L51_C2", "label": "missing_in_master", "type": "function", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.4478, 0.0174, 1, 0.74, 0.375, 277, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "missing_in_master", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def missing_in_master(self):\n return self._missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L51_C2", "vector": [13, 2, 0.4522, 0.0087, 2, 0.58, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L54_C2", "label": "missing_in_lang", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.4739, 0.0174, 1, 0.74, 0.5, 449, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "missing_in_lang", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def missing_in_lang(self):\n return self._missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L54_C2", "vector": [13, 2, 0.4783, 0.0087, 2, 0.54, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L57_C2", "label": "outdated_in_lang", "type": "function", "loc": [57, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.5, 0.0174, 1, 0.74, 0.625, 862, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "outdated_in_lang", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def outdated_in_lang(self):\n return self._outdated_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L58_C4", "label": "return", "type": "return", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L57_C2", "vector": [13, 2, 0.5043, 0.0087, 2, 0.91, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._outdated_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "label": "_Reset", "type": "function", "loc": [60, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.5391, 0.0435, 1, 0.74, 0.75, 412, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_Reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Reset(self):\n # These are maps from language to string name list\n self._missing_in_master = {}\n self._missing_in_lang = {}\n self._outdated_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L62_C4", "label": "self._missing_in_master =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "vector": [14, 2, 0.5391, 0.0087, 2, 0.91, 0.0, 252, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._missing_in_master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_master = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L63_C4", "label": "self._missing_in_lang =", "type": "assigned_variable", "loc": [63, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "vector": [14, 2, 0.5478, 0.0087, 2, 0.91, 0.5, 473, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._missing_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L64_C4", "label": "self._outdated_in_lang =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "vector": [14, 2, 0.5565, 0.0087, 2, 0.91, 1.0, 575, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._outdated_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._outdated_in_lang = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "label": "_ValidateMissingKeys", "type": "function", "loc": [66, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.6304, 0.1217, 1, 0.74, 0.875, 427, 0, 1, 0, 0, 0, 0, 7], "semantic": {"name": "_ValidateMissingKeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _ValidateMissingKeys(self):\n '''\n Computes whether there are missing keys on either side.\n '''\n master_keys = frozenset(self._master.iterkeys())\n for lang, file in self._langs.iteritems():\n keys = frozenset(file.iterkeys())\n missing_in_master = keys - master_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "vector": [8, 2, 0.5913, 0.0261, 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 Computes whether there are missing keys on either side.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L70_C4", "label": "master_keys = frozenset()", "type": "assigned_variable", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "vector": [14, 2, 0.6087, 0.0087, 2, 0.49, 0.5, 468, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "master_keys", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " master_keys = frozenset(self._master.iterkeys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "label": "for lang, file", "type": "for", "loc": [71, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "vector": [6, 2, 0.6522, 0.0783, 2, 0.49, 1.0, 275, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "lang, file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, file in self._langs.iteritems():\n keys = frozenset(file.iterkeys())\n missing_in_master = keys - master_keys\n missing_in_lang = master_keys - keys\n\n if len(missing_in_master) > 0:\n self._missing_in_master[lang] = missing_in_master\n if len(missing_in_lang) > 0:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L72_C6", "label": "keys = frozenset()", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.73, 0.0, 204, 3, 1, 0, 0, 80, 10, 2], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "frozenset", "annotation": ""}, "snippet": " keys = frozenset(file.iterkeys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L73_C6", "label": "missing_in_master =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "vector": [14, 3, 0.6348, 0.0087, 3, 0.73, 0.25, 277, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "missing_in_master", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " missing_in_master = keys - master_keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L74_C6", "label": "missing_in_lang =", "type": "assigned_variable", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "vector": [14, 3, 0.6435, 0.0087, 3, 0.73, 0.5, 449, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "missing_in_lang", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " missing_in_lang = master_keys - keys"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L76_C6", "label": "if", "type": "if", "loc": [76, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "vector": [4, 3, 0.6652, 0.0174, 3, 0.73, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(missing_in_master) > 0:\n self._missing_in_master[lang] = missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L77_C8", "label": "assign", "type": "assigned_variable", "loc": [77, 77], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L76_C6", "vector": [14, 4, 0.6696, 0.0087, 4, 0.7, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_master[lang] = missing_in_master"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L78_C6", "label": "if", "type": "if", "loc": [78, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "vector": [4, 3, 0.6826, 0.0174, 3, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(missing_in_lang) > 0:\n self._missing_in_lang[lang] = missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L79_C8", "label": "assign", "type": "assigned_variable", "loc": [79, 79], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L78_C6", "vector": [14, 4, 0.687, 0.0087, 4, 0.0, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._missing_in_lang[lang] = missing_in_lang"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2", "label": "_ValidateOutdatedKeys", "type": "function", "loc": [81, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "vector": [2, 1, 0.8522, 0.3043, 1, 0.74, 1.0, 676, 0, 1, 0, 0, 0, 0, 12], "semantic": {"name": "_ValidateOutdatedKeys", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _ValidateOutdatedKeys(self):\n '''\n Computers whether any of the language keys are outdated with relation to the\n master keys.\n '''\n for lang, file in self._langs.iteritems():\n outdated = []\n for key, str in file.iteritems():"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L82_C4", "label": "expression", "type": "expression", "loc": [82, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2", "vector": [8, 2, 0.7261, 0.0348, 2, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " '''\n Computers whether any of the language keys are outdated with relation to the\n master keys.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "label": "for lang, file", "type": "for", "loc": [86, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2", "vector": [6, 2, 0.8739, 0.2609, 2, 0.0, 1.0, 275, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "lang, file", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for lang, file in self._langs.iteritems():\n outdated = []\n for key, str in file.iteritems():\n # Get all revisions that touched master and language files for this\n # string.\n master_str = self._master[key]\n master_revs = master_str['revs']\n lang_revs = str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L87_C6", "label": "outdated =", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "vector": [14, 3, 0.7565, 0.0087, 3, 0.69, 0.0, 362, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "outdated", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " outdated = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "label": "for key, str", "type": "for", "loc": [88, 112], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "vector": [6, 3, 0.8696, 0.2174, 3, 0.69, 0.5, 83, 3, 0, 0, 0, 0, 0, 10], "semantic": {"name": "key, str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key, str in file.iteritems():\n # Get all revisions that touched master and language files for this\n # string.\n master_str = self._master[key]\n master_revs = master_str['revs']\n lang_revs = str['revs']\n if not master_revs or not lang_revs:\n print('WARNING: No revision for %s in %s' % (key, lang))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L91_C8", "label": "master_str =", "type": "assigned_variable", "loc": [91, 91], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.7913, 0.0087, 4, 0.35, 0.0, 440, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "master_str", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " master_str = self._master[key]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L92_C8", "label": "master_revs =", "type": "assigned_variable", "loc": [92, 92], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.8, 0.0087, 4, 0.35, 0.125, 616, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "master_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " master_revs = master_str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L93_C8", "label": "lang_revs =", "type": "assigned_variable", "loc": [93, 93], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.8087, 0.0087, 4, 0.35, 0.25, 522, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lang_revs", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lang_revs = str['revs']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L94_C8", "label": "if", "type": "if", "loc": [94, 96], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [4, 4, 0.8261, 0.0261, 4, 0.35, 0.375, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not master_revs or not lang_revs:\n print('WARNING: No revision for %s in %s' % (key, lang))\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L95_C10", "label": "print()", "type": "expression", "loc": [95, 95], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L94_C8", "vector": [8, 5, 0.8261, 0.0087, 5, 0.77, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('WARNING: No revision for %s in %s' % (key, lang))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L98_C8", "label": "master_file = join()", "type": "assigned_variable", "loc": [98, 98], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.8522, 0.0087, 4, 0.35, 0.5, 377, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "master_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " master_file = os.path.join(self._language_paths['en'], 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L99_C8", "label": "lang_file = join()", "type": "assigned_variable", "loc": [99, 99], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.8609, 0.0087, 4, 0.35, 0.625, 906, 3, 2, 0, 0, 933, 10, 1], "semantic": {"name": "lang_file", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " lang_file = os.path.join(self._language_paths[lang], 'strings.xml')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L103_C8", "label": "master_rev = reduce()", "type": "assigned_variable", "loc": [103, 105], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.9043, 0.0261, 4, 0.35, 0.75, 609, 3, 2, 0, 0, 622, 10, 2], "semantic": {"name": "master_rev", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " master_rev = reduce(\n lambda r1, r2: mytracks.history.NewestRevision(master_file, r1, r2),\n master_revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L106_C8", "label": "lang_rev = reduce()", "type": "assigned_variable", "loc": [106, 108], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [14, 4, 0.9304, 0.0261, 4, 0.35, 0.875, 74, 3, 2, 0, 0, 622, 10, 2], "semantic": {"name": "lang_rev", "arg_names": [], "import_names": [], "rhs_call_name": "reduce", "annotation": ""}, "snippet": " lang_rev = reduce(\n lambda r1, r2: mytracks.history.NewestRevision(lang_file, r1, r2),\n lang_revs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L111_C8", "label": "if", "type": "if", "loc": [111, 112], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "vector": [4, 4, 0.9696, 0.0174, 4, 0.35, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mytracks.history.DoesRevisionSuperceed(lang_file, master_rev, lang_rev):\n outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L112_C10", "label": "append()", "type": "expression", "loc": [112, 112], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L111_C8", "vector": [8, 5, 0.9739, 0.0087, 5, 0.84, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " outdated.append(key)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L114_C6", "label": "if", "type": "if", "loc": [114, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "vector": [4, 3, 0.9957, 0.0174, 3, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(outdated) > 0:\n self._outdated_in_lang[lang] = outdated"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L115_C8", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L114_C6", "vector": [14, 4, 1.0, 0.0087, 4, 0.56, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._outdated_in_lang[lang] = outdated"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L23_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L28_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L29_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L31_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L34_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L14_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L36_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L38_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Return_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L63_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L76_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L77_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L78_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L79_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:ClassDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:FunctionDef_L81_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L91_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L92_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L93_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L94_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L94_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L95_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L98_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L99_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L103_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L106_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L88_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L111_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L111_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Expr_L112_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:For_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1164:If_L114_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1164:Assign_L115_C8"}] |
'''
Module for dealing with resource files (but not their contents).
@author: Rodrigo Damazio
'''
import os.path
from glob import glob
import re
MYTRACKS_RES_DIR = 'MyTracks/res'
ANDROID_MASTER_VALUES = 'values'
ANDROID_VALUES_MASK = 'values-*'
def GetMyTracksDir():
'''
Returns the directory in which the MyTracks directory is located.
'''
path = os.getcwd()
while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)):
if path == '/':
raise 'Not in My Tracks project'
# Go up one level
path = os.path.split(path)[0]
return path
def GetAllLanguageFiles():
'''
Returns a mapping from all found languages to their respective directories.
'''
mytracks_path = GetMyTracksDir()
res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK)
language_dirs = glob(res_dir)
master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES)
if len(language_dirs) == 0:
raise 'No languages found!'
if not os.path.isdir(master_dir):
raise 'Couldn\'t find master file'
language_tuples = [(re.findall(r'.*values-([A-Za-z-]+)', dir)[0],dir) for dir in language_dirs]
language_tuples.append(('en', master_dir))
return dict(language_tuples)
| ajibawa-2023/Python-Code-Large/train/row_1165 | 25 | 45 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0667, 0.1111, 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 dealing with resource files (but not their contents).\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Import_L6_C0", "label": "os.path import os.path", "type": "import", "loc": [6, 6], "level": 0, "parent": null, "vector": [1, 0, 0.1333, 0.0222, 0, 0.66, 0.125, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["os.path"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os.path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:ImportFrom_L7_C0", "label": "from glob import glob", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1556, 0.0222, 0, 0.66, 0.25, 958, 0, 1, 0, 0, 958, 0, 0], "semantic": {"name": "glob", "arg_names": [], "import_names": ["glob"], "rhs_call_name": "", "annotation": ""}, "snippet": "from glob import glob"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Import_L8_C0", "label": "re import re", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1778, 0.0222, 0, 0.66, 0.375, 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_1165:Assign_L10_C0", "label": "MYTRACKS_RES_DIR =", "type": "assigned_variable", "loc": [10, 10], "level": 0, "parent": null, "vector": [14, 0, 0.2222, 0.0222, 0, 0.66, 0.5, 40, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MYTRACKS_RES_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MYTRACKS_RES_DIR = 'MyTracks/res'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L11_C0", "label": "ANDROID_MASTER_VALUES =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.2444, 0.0222, 0, 0.66, 0.625, 918, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANDROID_MASTER_VALUES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ANDROID_MASTER_VALUES = 'values'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L12_C0", "label": "ANDROID_VALUES_MASK =", "type": "assigned_variable", "loc": [12, 12], "level": 0, "parent": null, "vector": [14, 0, 0.2667, 0.0222, 0, 0.66, 0.75, 115, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ANDROID_VALUES_MASK", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ANDROID_VALUES_MASK = 'values-*'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "label": "GetMyTracksDir", "type": "function", "loc": [15, 27], "level": 0, "parent": null, "vector": [2, 0, 0.4667, 0.2889, 0, 0.66, 0.875, 854, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "GetMyTracksDir", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetMyTracksDir():\n '''\n Returns the directory in which the MyTracks directory is located.\n '''\n path = os.getcwd()\n while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)):\n if path == '/':\n raise 'Not in My Tracks project'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L16_C2", "label": "expression", "type": "expression", "loc": [16, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "vector": [8, 1, 0.3778, 0.0667, 1, 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 directory in which the MyTracks directory is located.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L19_C2", "label": "path = getcwd()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "vector": [14, 1, 0.4222, 0.0222, 1, 0.35, 0.3333, 358, 3, 0, 0, 0, 320, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "getcwd", "annotation": ""}, "snippet": " path = os.getcwd()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2", "label": "while", "type": "while", "loc": [20, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "vector": [5, 1, 0.5, 0.1333, 1, 0.35, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while not os.path.isdir(os.path.join(path, MYTRACKS_RES_DIR)):\n if path == '/':\n raise 'Not in My Tracks project'\n\n # Go up one level\n path = os.path.split(path)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L21_C4", "label": "if", "type": "if", "loc": [21, 22], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2", "vector": [4, 2, 0.4778, 0.0444, 2, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path == '/':\n raise 'Not in My Tracks project'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L25_C4", "label": "path =", "type": "assigned_variable", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2", "vector": [14, 2, 0.5556, 0.0222, 2, 0.11, 1.0, 358, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = os.path.split(path)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Return_L27_C2", "label": "return", "type": "return", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "vector": [13, 1, 0.6, 0.0222, 1, 0.35, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return path"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "label": "GetAllLanguageFiles", "type": "function", "loc": [30, 45], "level": 0, "parent": null, "vector": [2, 0, 0.8333, 0.3556, 0, 0.66, 1.0, 438, 0, 0, 1, 0, 0, 0, 9], "semantic": {"name": "GetAllLanguageFiles", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetAllLanguageFiles():\n '''\n Returns a mapping from all found languages to their respective directories.\n '''\n mytracks_path = GetMyTracksDir()\n res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK)\n language_dirs = glob(res_dir)\n master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [8, 1, 0.7111, 0.0667, 1, 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 a mapping from all found languages to their respective directories.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L34_C2", "label": "mytracks_path = GetMyTracksDir()", "type": "assigned_variable", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [14, 1, 0.7556, 0.0222, 1, 0.14, 0.1111, 720, 3, 0, 0, 0, 854, 10, 1], "semantic": {"name": "mytracks_path", "arg_names": [], "import_names": [], "rhs_call_name": "GetMyTracksDir", "annotation": ""}, "snippet": " mytracks_path = GetMyTracksDir()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L35_C2", "label": "res_dir = join()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [14, 1, 0.7778, 0.0222, 1, 0.14, 0.2222, 400, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "res_dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " res_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_VALUES_MASK)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L36_C2", "label": "language_dirs = glob()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [14, 1, 0.8, 0.0222, 1, 0.14, 0.3333, 191, 3, 1, 0, 0, 958, 10, 1], "semantic": {"name": "language_dirs", "arg_names": [], "import_names": [], "rhs_call_name": "glob", "annotation": ""}, "snippet": " language_dirs = glob(res_dir)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L37_C2", "label": "master_dir = join()", "type": "assigned_variable", "loc": [37, 37], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [14, 1, 0.8222, 0.0222, 1, 0.14, 0.4444, 493, 3, 3, 0, 0, 933, 10, 1], "semantic": {"name": "master_dir", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " master_dir = os.path.join(mytracks_path, MYTRACKS_RES_DIR, ANDROID_MASTER_VALUES)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L38_C2", "label": "if", "type": "if", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [4, 1, 0.8556, 0.0444, 1, 0.14, 0.5556, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(language_dirs) == 0:\n raise 'No languages found!'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L40_C2", "label": "if", "type": "if", "loc": [40, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [4, 1, 0.9, 0.0444, 1, 0.14, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not os.path.isdir(master_dir):\n raise 'Couldn\\'t find master file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L43_C2", "label": "language_tuples =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [14, 1, 0.9556, 0.0222, 1, 0.14, 0.7778, 966, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "language_tuples", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " language_tuples = [(re.findall(r'.*values-([A-Za-z-]+)', dir)[0],dir) for dir in language_dirs]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L44_C2", "label": "append()", "type": "expression", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [8, 1, 0.9778, 0.0222, 1, 0.14, 0.8889, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " language_tuples.append(('en', master_dir))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1165:Return_L45_C2", "label": "return", "type": "return", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "vector": [13, 1, 1.0, 0.0222, 1, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict(language_tuples)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:While_L20_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Return_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Expr_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1165:FunctionDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1165:Return_L45_C2"}] |
'''
Module which parses a string XML file.
@author: Rodrigo Damazio
'''
from xml.parsers.expat import ParserCreate
import re
#import xml.etree.ElementTree as ET
class StringsParser(object):
'''
Parser for string XML files.
This object is not thread-safe and should be used for parsing a single file at
a time, only.
'''
def Parse(self, file):
'''
Parses the given file and returns a dictionary mapping keys to an object
with attributes for that key, such as the value, start/end line and explicit
revisions.
In addition to the standard XML format of the strings file, this parser
supports an annotation inside comments, in one of these formats:
<!-- KEEP_PARENT name="bla" -->
<!-- KEEP_PARENT name="bla" rev="123456789012" -->
Such an annotation indicates that we're explicitly inheriting form the
master file (and the optional revision says that this decision is compatible
with the master file up to that revision).
@param file: the name of the file to parse
'''
self._Reset()
# Unfortunately expat is the only parser that will give us line numbers
self._xml_parser = ParserCreate()
self._xml_parser.StartElementHandler = self._StartElementHandler
self._xml_parser.EndElementHandler = self._EndElementHandler
self._xml_parser.CharacterDataHandler = self._CharacterDataHandler
self._xml_parser.CommentHandler = self._CommentHandler
file_obj = open(file)
self._xml_parser.ParseFile(file_obj)
file_obj.close()
return self._all_strings
def _Reset(self):
self._currentString = None
self._currentStringName = None
self._currentStringValue = None
self._all_strings = {}
def _StartElementHandler(self, name, attrs):
if name != 'string':
return
if 'name' not in attrs:
return
assert not self._currentString
assert not self._currentStringName
self._currentString = {
'startLine' : self._xml_parser.CurrentLineNumber,
}
if 'rev' in attrs:
self._currentString['revs'] = [attrs['rev']]
self._currentStringName = attrs['name']
self._currentStringValue = ''
def _EndElementHandler(self, name):
if name != 'string':
return
assert self._currentString
assert self._currentStringName
self._currentString['value'] = self._currentStringValue
self._currentString['endLine'] = self._xml_parser.CurrentLineNumber
self._all_strings[self._currentStringName] = self._currentString
self._currentString = None
self._currentStringName = None
self._currentStringValue = None
def _CharacterDataHandler(self, data):
if not self._currentString:
return
self._currentStringValue += data
_KEEP_PARENT_REGEX = re.compile(r'\s*KEEP_PARENT\s+'
r'name\s*=\s*[\'"]?(?P<name>[a-z0-9_]+)[\'"]?'
r'(?:\s+rev=[\'"]?(?P<rev>[0-9a-f]{12})[\'"]?)?\s*',
re.MULTILINE | re.DOTALL)
def _CommentHandler(self, data):
keep_parent_match = self._KEEP_PARENT_REGEX.match(data)
if not keep_parent_match:
return
name = keep_parent_match.group('name')
self._all_strings[name] = {
'keepParent' : True,
'startLine' : self._xml_parser.CurrentLineNumber,
'endLine' : self._xml_parser.CurrentLineNumber
}
rev = keep_parent_match.group('rev')
if rev:
self._all_strings[name]['revs'] = [rev] | ajibawa-2023/Python-Code-Large/train/row_1166 | 54 | 115 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 5], "level": 0, "parent": null, "vector": [8, 0, 0.0261, 0.0435, 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 which parses a string XML file.\n\n@author: Rodrigo Damazio\n'''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:ImportFrom_L7_C0", "label": "from xml.parsers.expat import ParserCreate", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0609, 0.0087, 0, 0.66, 0.3333, 573, 0, 1, 0, 0, 573, 0, 0], "semantic": {"name": "xml.parsers.expat", "arg_names": [], "import_names": ["ParserCreate"], "rhs_call_name": "", "annotation": ""}, "snippet": "from xml.parsers.expat import ParserCreate"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Import_L8_C0", "label": "re import re", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.0696, 0.0087, 0, 0.66, 0.6667, 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_1166:ClassDef_L11_C0", "label": "StringsParser", "type": "class", "loc": [11, 115], "level": 0, "parent": null, "vector": [3, 0, 0.5478, 0.913, 0, 0.66, 1.0, 282, 0, 6, 0, 0, 186, 0, 9], "semantic": {"name": "StringsParser", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class StringsParser(object):\n '''\n Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n '''\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L12_C2", "label": "expression", "type": "expression", "loc": [12, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [8, 1, 0.1261, 0.0522, 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 Parser for string XML files.\n\n This object is not thread-safe and should be used for parsing a single file at\n a time, only.\n '''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "label": "Parse", "type": "function", "loc": [19, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.3, 0.2783, 1, 0.93, 0.1429, 291, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "Parse", "arg_names": ["self", "file"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def Parse(self, file):\n '''\n Parses the given file and returns a dictionary mapping keys to an object\n with attributes for that key, such as the value, start/end line and explicit\n revisions.\n \n In addition to the standard XML format of the strings file, this parser\n supports an annotation inside comments, in one of these formats:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L20_C4", "label": "expression", "type": "expression", "loc": [20, 36], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [8, 2, 0.2435, 0.1478, 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 Parses the given file and returns a dictionary mapping keys to an object\n with attributes for that key, such as the value, start/end line and explicit\n revisions.\n \n In addition to the standard XML format of the strings file, this parser\n supports an annotation inside comments, in one of these formats:\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L37_C4", "label": "_Reset()", "type": "expression", "loc": [37, 37], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [8, 2, 0.3217, 0.0087, 2, 0.87, 0.1, 412, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "_Reset", "arg_names": [], "import_names": [], "rhs_call_name": "_Reset", "annotation": ""}, "snippet": " self._Reset()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L40_C4", "label": "self._xml_parser = ParserCreate()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.3478, 0.0087, 2, 0.87, 0.2, 822, 3, 0, 0, 0, 684, 10, 1], "semantic": {"name": "self._xml_parser", "arg_names": [], "import_names": [], "rhs_call_name": "ParserCreate", "annotation": ""}, "snippet": " self._xml_parser = ParserCreate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L41_C4", "label": "self._xml_parser.StartElementHandler =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.3565, 0.0087, 2, 0.87, 0.3, 260, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.StartElementHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.StartElementHandler = self._StartElementHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L42_C4", "label": "self._xml_parser.EndElementHandler =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.3652, 0.0087, 2, 0.87, 0.4, 744, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.EndElementHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.EndElementHandler = self._EndElementHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L43_C4", "label": "self._xml_parser.CharacterDataHandler =", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.3739, 0.0087, 2, 0.87, 0.5, 144, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.CharacterDataHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.CharacterDataHandler = self._CharacterDataHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L44_C4", "label": "self._xml_parser.CommentHandler =", "type": "assigned_variable", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.3826, 0.0087, 2, 0.87, 0.6, 403, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._xml_parser.CommentHandler", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._xml_parser.CommentHandler = self._CommentHandler"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L46_C4", "label": "file_obj = open()", "type": "assigned_variable", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [14, 2, 0.4, 0.0087, 2, 0.87, 0.7, 425, 3, 1, 0, 0, 693, 10, 1], "semantic": {"name": "file_obj", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file_obj = open(file)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L47_C4", "label": "ParseFile()", "type": "expression", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [8, 2, 0.4087, 0.0087, 2, 0.87, 0.8, 341, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "ParseFile", "arg_names": [], "import_names": [], "rhs_call_name": "ParseFile", "annotation": ""}, "snippet": " self._xml_parser.ParseFile(file_obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L48_C4", "label": "close()", "type": "expression", "loc": [48, 48], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [8, 2, 0.4174, 0.0087, 2, 0.87, 0.9, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file_obj.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "vector": [13, 2, 0.4348, 0.0087, 2, 0.87, 1.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return self._all_strings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "label": "_Reset", "type": "function", "loc": [52, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.4696, 0.0435, 1, 0.93, 0.2857, 412, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_Reset", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _Reset(self):\n self._currentString = None\n self._currentStringName = None\n self._currentStringValue = None\n self._all_strings = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L53_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "vector": [14, 2, 0.4609, 0.0087, 2, 0.84, 0.0, 654, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L54_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "vector": [14, 2, 0.4696, 0.0087, 2, 0.84, 0.3333, 294, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L55_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "vector": [14, 2, 0.4783, 0.0087, 2, 0.84, 0.6667, 884, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L56_C4", "label": "self._all_strings =", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "vector": [14, 2, 0.487, 0.0087, 2, 0.84, 1.0, 463, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._all_strings", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "label": "_StartElementHandler", "type": "function", "loc": [58, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.5783, 0.1565, 1, 0.93, 0.4286, 355, 0, 3, 0, 0, 0, 0, 0], "semantic": {"name": "_StartElementHandler", "arg_names": ["self", "name", "attrs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _StartElementHandler(self, name, attrs):\n if name != 'string':\n return\n\n if 'name' not in attrs:\n return\n\n assert not self._currentString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L59_C4", "label": "if", "type": "if", "loc": [59, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [4, 2, 0.5174, 0.0174, 2, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L60_C6", "label": "return", "type": "return", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L59_C4", "vector": [13, 3, 0.5217, 0.0087, 3, 0.24, 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_1166:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [4, 2, 0.5435, 0.0174, 2, 0.22, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'name' not in attrs:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L62_C4", "vector": [13, 3, 0.5478, 0.0087, 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"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L67_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [67, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [14, 2, 0.5913, 0.0261, 2, 0.22, 0.4, 654, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = {\n 'startLine' : self._xml_parser.CurrentLineNumber,\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L71_C4", "label": "if", "type": "if", "loc": [71, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [4, 2, 0.6217, 0.0174, 2, 0.22, 0.6, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if 'rev' in attrs:\n self._currentString['revs'] = [attrs['rev']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L72_C6", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L71_C4", "vector": [14, 3, 0.6261, 0.0087, 3, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['revs'] = [attrs['rev']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L74_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [14, 2, 0.6435, 0.0087, 2, 0.22, 0.8, 294, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = attrs['name']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L75_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "vector": [14, 2, 0.6522, 0.0087, 2, 0.22, 1.0, 884, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "label": "_EndElementHandler", "type": "function", "loc": [77, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.7217, 0.113, 1, 0.93, 0.5714, 486, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_EndElementHandler", "arg_names": ["self", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _EndElementHandler(self, name):\n if name != 'string':\n return\n\n assert self._currentString\n assert self._currentStringName\n self._currentString['value'] = self._currentStringValue\n self._currentString['endLine'] = self._xml_parser.CurrentLineNumber"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L78_C4", "label": "if", "type": "if", "loc": [78, 79], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [4, 2, 0.6826, 0.0174, 2, 0.05, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if name != 'string':\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L79_C6", "label": "return", "type": "return", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L78_C4", "vector": [13, 3, 0.687, 0.0087, 3, 0.85, 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_1166:Assign_L83_C4", "label": "assign", "type": "assigned_variable", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7217, 0.0087, 2, 0.05, 0.1667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['value'] = self._currentStringValue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L84_C4", "label": "assign", "type": "assigned_variable", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7304, 0.0087, 2, 0.05, 0.3333, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString['endLine'] = self._xml_parser.CurrentLineNumber"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L85_C4", "label": "assign", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7391, 0.0087, 2, 0.05, 0.5, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[self._currentStringName] = self._currentString"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L87_C4", "label": "self._currentString =", "type": "assigned_variable", "loc": [87, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7565, 0.0087, 2, 0.05, 0.6667, 654, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentString", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentString = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L88_C4", "label": "self._currentStringName =", "type": "assigned_variable", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7652, 0.0087, 2, 0.05, 0.8333, 294, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringName", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringName = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L89_C4", "label": "self._currentStringValue =", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "vector": [14, 2, 0.7739, 0.0087, 2, 0.05, 1.0, 884, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "self._currentStringValue", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._currentStringValue = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L91_C2", "label": "_CharacterDataHandler", "type": "function", "loc": [91, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.8087, 0.0435, 1, 0.93, 0.7143, 825, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "_CharacterDataHandler", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CharacterDataHandler(self, data):\n if not self._currentString:\n return\n\n self._currentStringValue += data"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L91_C2", "vector": [4, 2, 0.8043, 0.0174, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not self._currentString:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L92_C4", "vector": [13, 3, 0.8087, 0.0087, 3, 0.47, 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_1166:Assign_L97_C2", "label": "_KEEP_PARENT_REGEX = compile()", "type": "assigned_variable", "loc": [97, 100], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [14, 1, 0.8565, 0.0348, 1, 0.93, 0.8571, 591, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "_KEEP_PARENT_REGEX", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": " _KEEP_PARENT_REGEX = re.compile(r'\\s*KEEP_PARENT\\s+'\n r'name\\s*=\\s*[\\'\"]?(?P<name>[a-z0-9_]+)[\\'\"]?'\n r'(?:\\s+rev=[\\'\"]?(?P<rev>[0-9a-f]{12})[\\'\"]?)?\\s*',\n re.MULTILINE | re.DOTALL)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "label": "_CommentHandler", "type": "function", "loc": [102, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "vector": [2, 1, 0.9435, 0.1217, 1, 0.93, 1.0, 562, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_CommentHandler", "arg_names": ["self", "data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _CommentHandler(self, data):\n keep_parent_match = self._KEEP_PARENT_REGEX.match(data)\n if not keep_parent_match:\n return\n\n name = keep_parent_match.group('name')\n self._all_strings[name] = {\n 'keepParent' : True,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L103_C4", "label": "keep_parent_match = match()", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [14, 2, 0.8957, 0.0087, 2, 0.11, 0.0, 885, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "keep_parent_match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " keep_parent_match = self._KEEP_PARENT_REGEX.match(data)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L104_C4", "label": "if", "type": "if", "loc": [104, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [4, 2, 0.9087, 0.0174, 2, 0.11, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not keep_parent_match:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L105_C6", "label": "return", "type": "return", "loc": [105, 105], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L104_C4", "vector": [13, 3, 0.913, 0.0087, 3, 0.53, 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_1166:Assign_L107_C4", "label": "name = group()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [14, 2, 0.9304, 0.0087, 2, 0.11, 0.4, 57, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "name", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " name = keep_parent_match.group('name')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L108_C4", "label": "assign", "type": "assigned_variable", "loc": [108, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [14, 2, 0.9565, 0.0435, 2, 0.11, 0.6, 0, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[name] = {\n 'keepParent' : True,\n 'startLine' : self._xml_parser.CurrentLineNumber,\n 'endLine' : self._xml_parser.CurrentLineNumber\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L113_C4", "label": "rev = group()", "type": "assigned_variable", "loc": [113, 113], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [14, 2, 0.9826, 0.0087, 2, 0.11, 0.8, 337, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "rev", "arg_names": [], "import_names": [], "rhs_call_name": "group", "annotation": ""}, "snippet": " rev = keep_parent_match.group('rev')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L114_C4", "label": "if", "type": "if", "loc": [114, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "vector": [4, 2, 0.9957, 0.0174, 2, 0.11, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev:\n self._all_strings[name]['revs'] = [rev]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L115_C6", "label": "assign", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L114_C4", "vector": [14, 3, 1.0, 0.0087, 3, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self._all_strings[name]['revs'] = [rev]"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L12_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L37_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Expr_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L19_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L71_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L78_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L87_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L77_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L104_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L104_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Return_L105_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:FunctionDef_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L114_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1166:If_L114_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1166:Assign_L115_C6"}] |
#
# Generate and deploy the jar and associated files to the Sonatype maven repository.
#
import os, re, tempfile, subprocess #, sys, datetime, zipfile
# Location of the source file that defines the current version
VERSION_FILE = '../src/com/caverock/androidsvg/SVG.java'
# Version regex
VERSION_RE = '\sVERSION\s*=\s*"([\d.]+)"'
# Source pom file
ORIG_POM_FILE = 'src-pom.xml'
# Regex for finding the place in the pom file to insert the version number
POM_VERSION_RE = '{{VERSION}}'
# The jar file to be deployed
JAR_FILE = '../bin/androidsvg.jar'
# The dummy sources and javadoc jars
SOURCES_JAR_FILE = 'androidsvg-sources.jar'
JAVADOC_JAR_FILE = 'androidsvg-javadoc.jar'
def main():
# Get the current version number of the library
libraryVersion = get_current_version()
go = raw_input('\nDo maven deploy for version '+libraryVersion+'? (y/N): ')
if not go in ['Y','y']:
exit()
# Get GPG passphrase
#passphrase = raw_input('GPG passphrase: ')
#if passphrase == '':
# print "Exiting: need passphrase."
# exit()
# Create a temporary file to hold the generated pom file
print 'Creating POM file for this version...'
tempPomFile = tempfile.NamedTemporaryFile(suffix='.pom.xml', delete=False)
#print tempPomFile.name
# Write out a new pom file with the version number set to the latest version
srcPomFile = read(ORIG_POM_FILE)
tempPomFile.write(re.sub(POM_VERSION_RE, libraryVersion, srcPomFile))
tempPomFile.close()
# Sign and deploy the artifact
print '\nSigning and deploying artifact...'
basecmd = 'mvn gpg:sign-and-deploy-file'
basecmd += ' -DpomFile=' + tempPomFile.name
basecmd += ' -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/'
basecmd += ' -DrepositoryId=sonatype-nexus-staging'
#basecmd += ' -Dpassphrase=' + passphrase
cmd = basecmd
cmd += ' -Dfile=' + os.path.realpath(JAR_FILE)
print cmd
os.system(cmd)
# Sign and deploy the dummy sources
print '\nSigning and deploying sources jar...'
cmd = basecmd
cmd += ' -Dfile=' + os.path.realpath(SOURCES_JAR_FILE)
cmd += ' -Dclassifier=sources'
print cmd
os.system(cmd)
# Sign and deploy the dummy javadoc
print '\nSigning and deploying javadoc jar...'
cmd = basecmd
cmd += ' -Dfile=' + os.path.realpath(JAVADOC_JAR_FILE)
cmd += ' -Dclassifier=javadoc'
print cmd
os.system(cmd)
# Done
print '\nDone!'
def read(src):
file = open(os.path.realpath(src), "rb")
str = file.read()
file.close()
return str
def get_current_version():
versionFile = read(VERSION_FILE)
m = re.search(VERSION_RE, versionFile)
if (m):
return m.group(1)
else:
return ""
def error(msg):
print "ERROR: "+ msg
exit()
if __name__ == "__main__":
main()
| ajibawa-2023/Python-Code-Large/train/row_1167 | 48 | 117 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Import_L5_C0", "label": "os import os, re, tempfile\u2026", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0427, 0.0085, 0, 0.66, 0.0, 688, 0, 4, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os", "re", "tempfile", "subprocess"], "rhs_call_name": "", "annotation": ""}, "snippet": "import os, re, tempfile, subprocess #, sys, datetime, zipfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L8_C0", "label": "VERSION_FILE =", "type": "assigned_variable", "loc": [8, 8], "level": 0, "parent": null, "vector": [14, 0, 0.0684, 0.0085, 0, 0.66, 0.0833, 837, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION_FILE = '../src/com/caverock/androidsvg/SVG.java'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L11_C0", "label": "VERSION_RE =", "type": "assigned_variable", "loc": [11, 11], "level": 0, "parent": null, "vector": [14, 0, 0.094, 0.0085, 0, 0.66, 0.1667, 276, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION_RE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "VERSION_RE = '\\sVERSION\\s*=\\s*\"([\\d.]+)\"'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L14_C0", "label": "ORIG_POM_FILE =", "type": "assigned_variable", "loc": [14, 14], "level": 0, "parent": null, "vector": [14, 0, 0.1197, 0.0085, 0, 0.66, 0.25, 497, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ORIG_POM_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ORIG_POM_FILE = 'src-pom.xml'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L17_C0", "label": "POM_VERSION_RE =", "type": "assigned_variable", "loc": [17, 17], "level": 0, "parent": null, "vector": [14, 0, 0.1453, 0.0085, 0, 0.66, 0.3333, 978, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "POM_VERSION_RE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "POM_VERSION_RE = '{{VERSION}}'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L20_C0", "label": "JAR_FILE =", "type": "assigned_variable", "loc": [20, 20], "level": 0, "parent": null, "vector": [14, 0, 0.1709, 0.0085, 0, 0.66, 0.4167, 567, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "JAR_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "JAR_FILE = '../bin/androidsvg.jar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L23_C0", "label": "SOURCES_JAR_FILE =", "type": "assigned_variable", "loc": [23, 23], "level": 0, "parent": null, "vector": [14, 0, 0.1966, 0.0085, 0, 0.66, 0.5, 613, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "SOURCES_JAR_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "SOURCES_JAR_FILE = 'androidsvg-sources.jar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L24_C0", "label": "JAVADOC_JAR_FILE =", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.2051, 0.0085, 0, 0.66, 0.5833, 674, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "JAVADOC_JAR_FILE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "JAVADOC_JAR_FILE = 'androidsvg-javadoc.jar'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "label": "main", "type": "function", "loc": [27, 90], "level": 0, "parent": null, "vector": [2, 0, 0.5, 0.547, 0, 0.66, 0.6667, 624, 0, 0, 0, 0, 0, 0, 22], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n\n # Get the current version number of the library\n libraryVersion = get_current_version()\n \n go = raw_input('\\nDo maven deploy for version '+libraryVersion+'? (y/N): ')\n if not go in ['Y','y']:\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L30_C2", "label": "libraryVersion = get_current_version()", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.2564, 0.0085, 1, 0.46, 0.0, 415, 3, 0, 0, 0, 21, 10, 1], "semantic": {"name": "libraryVersion", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_version", "annotation": ""}, "snippet": " libraryVersion = get_current_version()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L32_C2", "label": "go = raw_input()", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.2735, 0.0085, 1, 0.46, 0.0476, 917, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "go", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " go = raw_input('\\nDo maven deploy for version '+libraryVersion+'? (y/N): ')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L33_C2", "label": "if", "type": "if", "loc": [33, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [4, 1, 0.2863, 0.0171, 1, 0.46, 0.0952, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not go in ['Y','y']:\n exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L34_C4", "label": "exit()", "type": "expression", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L33_C2", "vector": [8, 2, 0.2906, 0.0085, 2, 0.26, 0.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L43_C2", "label": "print()", "type": "expression", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.3675, 0.0085, 1, 0.46, 0.1429, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Creating POM file for this version...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L44_C2", "label": "tempPomFile = NamedTemporaryFile()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.3761, 0.0085, 1, 0.46, 0.1905, 561, 3, 2, 0, 0, 349, 10, 1], "semantic": {"name": "tempPomFile", "arg_names": [], "import_names": [], "rhs_call_name": "NamedTemporaryFile", "annotation": ""}, "snippet": " tempPomFile = tempfile.NamedTemporaryFile(suffix='.pom.xml', delete=False)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L48_C2", "label": "srcPomFile = read()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.4103, 0.0085, 1, 0.46, 0.2381, 536, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "srcPomFile", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " srcPomFile = read(ORIG_POM_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L49_C2", "label": "write()", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.4188, 0.0085, 1, 0.46, 0.2857, 837, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " tempPomFile.write(re.sub(POM_VERSION_RE, libraryVersion, srcPomFile))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L50_C2", "label": "close()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.4274, 0.0085, 1, 0.46, 0.3333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " tempPomFile.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L54_C2", "label": "print()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.4615, 0.0085, 1, 0.46, 0.381, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nSigning and deploying artifact...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L55_C2", "label": "basecmd =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.4701, 0.0085, 1, 0.46, 0.4286, 964, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "basecmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " basecmd = 'mvn gpg:sign-and-deploy-file'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L61_C2", "label": "cmd =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.5214, 0.0085, 1, 0.46, 0.4762, 604, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = basecmd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L64_C2", "label": "print()", "type": "expression", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.547, 0.0085, 1, 0.46, 0.5238, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L65_C2", "label": "system()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.5556, 0.0085, 1, 0.46, 0.5714, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L69_C2", "label": "print()", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.5897, 0.0085, 1, 0.46, 0.619, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nSigning and deploying sources jar...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L71_C2", "label": "cmd =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.6068, 0.0085, 1, 0.46, 0.6667, 604, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = basecmd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L75_C2", "label": "print()", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.641, 0.0085, 1, 0.46, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L76_C2", "label": "system()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.6496, 0.0085, 1, 0.46, 0.7619, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L80_C2", "label": "print()", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.6838, 0.0085, 1, 0.46, 0.8095, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nSigning and deploying javadoc jar...')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L82_C2", "label": "cmd =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [14, 1, 0.7009, 0.0085, 1, 0.46, 0.8571, 604, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cmd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cmd = basecmd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L86_C2", "label": "print()", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.735, 0.0085, 1, 0.46, 0.9048, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L87_C2", "label": "system()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.7436, 0.0085, 1, 0.46, 0.9524, 856, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "system", "arg_names": [], "import_names": [], "rhs_call_name": "system", "annotation": ""}, "snippet": " os.system(cmd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L90_C2", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "vector": [8, 1, 0.7692, 0.0085, 1, 0.46, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\nDone!')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "label": "read", "type": "function", "loc": [94, 98], "level": 0, "parent": null, "vector": [2, 0, 0.8205, 0.0427, 0, 0.66, 0.75, 453, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "read", "arg_names": ["src"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read(src):\n file = open(os.path.realpath(src), \"rb\")\n str = file.read()\n file.close()\n return str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L95_C2", "label": "file = open()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "vector": [14, 1, 0.812, 0.0085, 1, 0.17, 0.0, 107, 3, 2, 0, 0, 693, 10, 2], "semantic": {"name": "file", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " file = open(os.path.realpath(src), \"rb\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L96_C2", "label": "str = read()", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "vector": [14, 1, 0.8205, 0.0085, 1, 0.17, 0.3333, 52, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str = file.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L97_C2", "label": "close()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "vector": [8, 1, 0.8291, 0.0085, 1, 0.17, 0.6667, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " file.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L98_C2", "label": "return", "type": "return", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "vector": [13, 1, 0.8376, 0.0085, 1, 0.17, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return str"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "label": "get_current_version", "type": "function", "loc": [101, 107], "level": 0, "parent": null, "vector": [2, 0, 0.8889, 0.0598, 0, 0.66, 0.8333, 21, 0, 0, 1, 0, 0, 0, 3], "semantic": {"name": "get_current_version", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_current_version():\n versionFile = read(VERSION_FILE)\n m = re.search(VERSION_RE, versionFile)\n if (m):\n return m.group(1)\n else:\n return \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L102_C2", "label": "versionFile = read()", "type": "assigned_variable", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "vector": [14, 1, 0.8718, 0.0085, 1, 0.48, 0.0, 256, 3, 1, 0, 0, 453, 10, 1], "semantic": {"name": "versionFile", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " versionFile = read(VERSION_FILE)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L103_C2", "label": "m = search()", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "vector": [14, 1, 0.8803, 0.0085, 1, 0.48, 0.5, 711, 3, 2, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": " m = re.search(VERSION_RE, versionFile)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2", "label": "if", "type": "if", "loc": [104, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "vector": [4, 1, 0.9017, 0.0342, 1, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if (m):\n return m.group(1)\n else:\n return \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L105_C4", "label": "return", "type": "return", "loc": [105, 105], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2", "vector": [13, 2, 0.8974, 0.0085, 2, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return m.group(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L107_C4", "label": "return", "type": "return", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2", "vector": [13, 2, 0.9145, 0.0085, 2, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L110_C0", "label": "error", "type": "function", "loc": [110, 112], "level": 0, "parent": null, "vector": [2, 0, 0.9487, 0.0256, 0, 0.66, 0.9167, 771, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "error", "arg_names": ["msg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def error(msg):\n print(\"ERROR: \"+ msg)\n exit() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L111_C2", "label": "print()", "type": "expression", "loc": [111, 111], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L110_C0", "vector": [8, 1, 0.9487, 0.0085, 1, 0.05, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"ERROR: \"+ msg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L112_C2", "label": "exit()", "type": "expression", "loc": [112, 112], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L110_C0", "vector": [8, 1, 0.9573, 0.0085, 1, 0.05, 1.0, 436, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " exit() "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L116_C0", "label": "if", "type": "if", "loc": [116, 117], "level": 0, "parent": null, "vector": [4, 0, 0.9957, 0.0171, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L117_C2", "label": "main()", "type": "expression", "loc": [117, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L116_C0", "vector": [8, 1, 1.0, 0.0085, 1, 0.84, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L94_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Return_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L112_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1167:If_L116_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1167:Expr_L117_C2"}] |
import Download
pagelist=['http://www.economist.com/']
print("Starting ....")
crawler = Download.crawler('')
crawler.crawl(pagelist)
| ajibawa-2023/Python-Code-Large/train/row_1168 | 5 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1168:Import_L1_C0", "label": "Download import Download", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.1429, 0, 0.66, 0.0, 175, 0, 1, 0, 0, 175, 0, 0], "semantic": {"name": "Download", "arg_names": [], "import_names": ["Download"], "rhs_call_name": "", "annotation": ""}, "snippet": "import Download"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1168:Assign_L3_C0", "label": "pagelist =", "type": "assigned_variable", "loc": [3, 3], "level": 0, "parent": null, "vector": [14, 0, 0.4286, 0.1429, 0, 0.66, 0.25, 340, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pagelist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "pagelist=['http://www.economist.com/']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1168:Expr_L4_C0", "label": "print()", "type": "expression", "loc": [4, 4], "level": 0, "parent": null, "vector": [8, 0, 0.5714, 0.1429, 0, 0.66, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "print(\"Starting ....\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1168:Assign_L5_C0", "label": "crawler = crawler()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.7143, 0.1429, 0, 0.66, 0.75, 920, 3, 1, 0, 0, 920, 10, 1], "semantic": {"name": "crawler", "arg_names": [], "import_names": [], "rhs_call_name": "crawler", "annotation": ""}, "snippet": "crawler = Download.crawler('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1168:Expr_L6_C0", "label": "crawl()", "type": "expression", "loc": [6, 6], "level": 0, "parent": null, "vector": [8, 0, 0.8571, 0.1429, 0, 0.66, 1.0, 838, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "crawl", "arg_names": [], "import_names": [], "rhs_call_name": "crawl", "annotation": ""}, "snippet": "crawler.crawl(pagelist)"}] | [] |
import urllib
import re
urlArg = 'http://www.yahoo.com'
filehandle = urllib.urlopen(urlArg)
for lines in filehandle.readlines():
m = re.search('http\://[\w\./]+/\w+',lines)
if m:
print m.group(0)
filehandle.close()
| ajibawa-2023/Python-Code-Large/train/row_1170 | 9 | 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_1170:Import_L1_C0", "label": "urllib import urllib", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0667, 0.0667, 0, 0.66, 0.0, 614, 0, 1, 0, 0, 614, 0, 0], "semantic": {"name": "urllib", "arg_names": [], "import_names": ["urllib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urllib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:Import_L2_C0", "label": "re import re", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.1333, 0.0667, 0, 0.66, 0.2, 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_1170:Assign_L4_C0", "label": "urlArg =", "type": "assigned_variable", "loc": [4, 4], "level": 0, "parent": null, "vector": [14, 0, 0.2667, 0.0667, 0, 0.66, 0.4, 792, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "urlArg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "urlArg = 'http://www.yahoo.com'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:Assign_L5_C0", "label": "filehandle = urlopen()", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.3333, 0.0667, 0, 0.66, 0.6, 575, 3, 1, 0, 0, 687, 10, 1], "semantic": {"name": "filehandle", "arg_names": [], "import_names": [], "rhs_call_name": "urlopen", "annotation": ""}, "snippet": "filehandle = urllib.urlopen(urlArg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:For_L7_C0", "label": "for lines", "type": "for", "loc": [7, 10], "level": 0, "parent": null, "vector": [6, 0, 0.5667, 0.2667, 0, 0.66, 0.8, 73, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "for lines in filehandle.readlines():\n\tm = re.search('http\\://[\\w\\./]+/\\w+',lines)\n\tif m:\n\t\tprint(m.group(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:Assign_L8_C1", "label": "m = search()", "type": "assigned_variable", "loc": [8, 8], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1170:For_L7_C0", "vector": [14, 1, 0.5333, 0.0667, 1, 0.2, 0.0, 711, 3, 2, 0, 0, 163, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "search", "annotation": ""}, "snippet": "\tm = re.search('http\\://[\\w\\./]+/\\w+',lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:If_L9_C1", "label": "if", "type": "if", "loc": [9, 10], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1170:For_L7_C0", "vector": [4, 1, 0.6333, 0.1333, 1, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\tif m:\n\t\tprint(m.group(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:Expr_L10_C2", "label": "print()", "type": "expression", "loc": [10, 10], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1170:If_L9_C1", "vector": [8, 2, 0.6667, 0.0667, 2, 0.53, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": "\t\tprint(m.group(0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1170:Expr_L12_C0", "label": "close()", "type": "expression", "loc": [12, 12], "level": 0, "parent": null, "vector": [8, 0, 0.8, 0.0667, 0, 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": "filehandle.close()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1170:For_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1170:Assign_L8_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1170:For_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1170:If_L9_C1"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1170:If_L9_C1", "t": "ajibawa-2023/Python-Code-Large/train/row_1170:Expr_L10_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Main program for Rietveld.
This is also a template for running a Django app under Google App
Engine, especially when using a newer version of Django than provided
in the App Engine standard library.
The site-specific code is all in other files: urls.py, models.py,
views.py, settings.py.
"""
# Standard Python imports.
import os
import sys
import logging
# Log a message each time this module get loaded.
logging.info('Loading %s, app version = %s',
__name__, os.getenv('CURRENT_VERSION_ID'))
import appengine_config
# AppEngine imports.
from google.appengine.ext.webapp import util
# Import webapp.template. This makes most Django setup issues go away.
from google.appengine.ext.webapp import template
# Import various parts of Django.
import django.core.handlers.wsgi
import django.core.signals
import django.db
import django.dispatch.dispatcher
import django.forms
def log_exception(*args, **kwds):
"""Django signal handler to log an exception."""
cls, err = sys.exc_info()[:2]
logging.exception('Exception in request: %s: %s', cls.__name__, err)
# Log all exceptions detected by Django.
django.core.signals.got_request_exception.connect(log_exception)
# Unregister Django's default rollback event handler.
django.core.signals.got_request_exception.disconnect(
django.db._rollback_on_exception)
# Create a Django application for WSGI.
application = django.core.handlers.wsgi.WSGIHandler()
def real_main():
"""Main program."""
# Run the WSGI CGI handler with that application.
util.run_wsgi_app(application)
def profile_main():
"""Main program for profiling."""
import cProfile
import pstats
import StringIO
prof = cProfile.Profile()
prof = prof.runctx('real_main()', globals(), locals())
stream = StringIO.StringIO()
stats = pstats.Stats(prof, stream=stream)
# stats.strip_dirs() # Don't; too many modules are named __init__.py.
stats.sort_stats('time') # 'time', 'cumulative' or 'calls'
stats.print_stats() # Optional arg: how many to print
# The rest is optional.
# stats.print_callees()
# stats.print_callers()
print '\n<hr>'
print '<h1>Profile</h1>'
print '<pre>'
print stream.getvalue()[:1000000]
print '</pre>'
# Set this to profile_main to enable profiling.
main = real_main
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1171 | 42 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 23], "level": 0, "parent": null, "vector": [8, 0, 0.1881, 0.0891, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Main program for Rietveld.\n\nThis is also a template for running a Django app under Google App\nEngine, especially when using a newer version of Django than provided\nin the App Engine standard library.\n\nThe site-specific code is all in other files: urls.py, models.py,\nviews.py, settings.py."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L26_C0", "label": "os import os", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.2574, 0.0099, 0, 0.66, 0.05, 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_1171:Import_L27_C0", "label": "sys import sys", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.2673, 0.0099, 0, 0.66, 0.1, 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_1171:Import_L28_C0", "label": "logging import logging", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.2772, 0.0099, 0, 0.66, 0.15, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L31_C0", "label": "info()", "type": "expression", "loc": [31, 32], "level": 0, "parent": null, "vector": [8, 0, 0.3119, 0.0198, 0, 0.66, 0.2, 730, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "logging.info('Loading %s, app version = %s',\n __name__, os.getenv('CURRENT_VERSION_ID'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L34_C0", "label": "appengine_config import appengine_config", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.3366, 0.0099, 0, 0.66, 0.25, 927, 0, 1, 0, 0, 927, 0, 0], "semantic": {"name": "appengine_config", "arg_names": [], "import_names": ["appengine_config"], "rhs_call_name": "", "annotation": ""}, "snippet": "import appengine_config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:ImportFrom_L37_C0", "label": "from google.appengine.ext.webapp import util", "type": "import", "loc": [37, 37], "level": 0, "parent": null, "vector": [1, 0, 0.3663, 0.0099, 0, 0.66, 0.3, 8, 0, 1, 0, 0, 8, 0, 0], "semantic": {"name": "google.appengine.ext.webapp", "arg_names": [], "import_names": ["util"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp import util"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:ImportFrom_L40_C0", "label": "from google.appengine.ext.webapp import template", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.396, 0.0099, 0, 0.66, 0.35, 8, 0, 1, 0, 0, 8, 0, 0], "semantic": {"name": "google.appengine.ext.webapp", "arg_names": [], "import_names": ["template"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.webapp import template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L44_C0", "label": "django.core.handlers.wsgi import django.core.handlers.wsgi", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4356, 0.0099, 0, 0.66, 0.4, 643, 0, 1, 0, 0, 643, 0, 0], "semantic": {"name": "django.core.handlers.wsgi", "arg_names": [], "import_names": ["django.core.handlers.wsgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.core.handlers.wsgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L45_C0", "label": "django.core.signals import django.core.signals", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4455, 0.0099, 0, 0.66, 0.45, 436, 0, 1, 0, 0, 436, 0, 0], "semantic": {"name": "django.core.signals", "arg_names": [], "import_names": ["django.core.signals"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.core.signals"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L46_C0", "label": "django.db import django.db", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4554, 0.0099, 0, 0.66, 0.5, 40, 0, 1, 0, 0, 40, 0, 0], "semantic": {"name": "django.db", "arg_names": [], "import_names": ["django.db"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L47_C0", "label": "django.dispatch.dispatcher import django.dispatch.dispatcher", "type": "import", "loc": [47, 47], "level": 0, "parent": null, "vector": [1, 0, 0.4653, 0.0099, 0, 0.66, 0.55, 819, 0, 1, 0, 0, 819, 0, 0], "semantic": {"name": "django.dispatch.dispatcher", "arg_names": [], "import_names": ["django.dispatch.dispatcher"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.dispatch.dispatcher"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L48_C0", "label": "django.forms import django.forms", "type": "import", "loc": [48, 48], "level": 0, "parent": null, "vector": [1, 0, 0.4752, 0.0099, 0, 0.66, 0.6, 666, 0, 1, 0, 0, 666, 0, 0], "semantic": {"name": "django.forms", "arg_names": [], "import_names": ["django.forms"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.forms"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "label": "log_exception", "type": "function", "loc": [51, 54], "level": 0, "parent": null, "vector": [2, 0, 0.5198, 0.0396, 0, 0.66, 0.65, 744, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "log_exception", "arg_names": ["args", "kwds"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def log_exception(*args, **kwds):\n \"\"\"Django signal handler to log an exception.\"\"\"\n cls, err = sys.exc_info()[:2]\n logging.exception('Exception in request: %s: %s', cls.__name__, err)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L52_C2", "label": "expression", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "vector": [8, 1, 0.5149, 0.0099, 1, 0.85, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Django signal handler to log an exception.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L53_C2", "label": "cls, err =", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "vector": [14, 1, 0.5248, 0.0099, 1, 0.85, 0.5, 775, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "cls, err", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls, err = sys.exc_info()[:2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L54_C2", "label": "exception()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "vector": [8, 1, 0.5347, 0.0099, 1, 0.85, 1.0, 69, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " logging.exception('Exception in request: %s: %s', cls.__name__, err)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L58_C0", "label": "connect()", "type": "expression", "loc": [58, 58], "level": 0, "parent": null, "vector": [8, 0, 0.5743, 0.0099, 0, 0.66, 0.7, 242, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "connect", "arg_names": [], "import_names": [], "rhs_call_name": "connect", "annotation": ""}, "snippet": "django.core.signals.got_request_exception.connect(log_exception)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L61_C0", "label": "disconnect()", "type": "expression", "loc": [61, 62], "level": 0, "parent": null, "vector": [8, 0, 0.6089, 0.0198, 0, 0.66, 0.75, 978, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "disconnect", "arg_names": [], "import_names": [], "rhs_call_name": "disconnect", "annotation": ""}, "snippet": "django.core.signals.got_request_exception.disconnect(\n django.db._rollback_on_exception)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L65_C0", "label": "application = WSGIHandler()", "type": "assigned_variable", "loc": [65, 65], "level": 0, "parent": null, "vector": [14, 0, 0.6436, 0.0099, 0, 0.66, 0.8, 244, 3, 0, 0, 0, 465, 10, 1], "semantic": {"name": "application", "arg_names": [], "import_names": [], "rhs_call_name": "WSGIHandler", "annotation": ""}, "snippet": "application = django.core.handlers.wsgi.WSGIHandler()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L68_C0", "label": "real_main", "type": "function", "loc": [68, 71], "level": 0, "parent": null, "vector": [2, 0, 0.6881, 0.0396, 0, 0.66, 0.85, 815, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "real_main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def real_main():\n \"\"\"Main program.\"\"\"\n # Run the WSGI CGI handler with that application.\n util.run_wsgi_app(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L69_C2", "label": "expression", "type": "expression", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L68_C0", "vector": [8, 1, 0.6832, 0.0099, 1, 0.23, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Main program.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L71_C2", "label": "run_wsgi_app()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L68_C0", "vector": [8, 1, 0.703, 0.0099, 1, 0.23, 1.0, 563, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "run_wsgi_app", "arg_names": [], "import_names": [], "rhs_call_name": "run_wsgi_app", "annotation": ""}, "snippet": " util.run_wsgi_app(application)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "label": "profile_main", "type": "function", "loc": [74, 94], "level": 0, "parent": null, "vector": [2, 0, 0.8317, 0.2079, 0, 0.66, 0.9, 182, 0, 0, 0, 0, 0, 0, 14], "semantic": {"name": "profile_main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def profile_main():\n \"\"\"Main program for profiling.\"\"\"\n import cProfile\n import pstats\n import StringIO\n\n prof = cProfile.Profile()\n prof = prof.runctx('real_main()', globals(), locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L75_C2", "label": "expression", "type": "expression", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.7426, 0.0099, 1, 0.6, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Main program for profiling.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L76_C2", "label": "cProfile import cProfile", "type": "import", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [1, 1, 0.7525, 0.0099, 1, 0.6, 0.0714, 686, 0, 1, 0, 0, 686, 0, 0], "semantic": {"name": "cProfile", "arg_names": [], "import_names": ["cProfile"], "rhs_call_name": "", "annotation": ""}, "snippet": " import cProfile"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L77_C2", "label": "pstats import pstats", "type": "import", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [1, 1, 0.7624, 0.0099, 1, 0.6, 0.1429, 936, 0, 1, 0, 0, 936, 0, 0], "semantic": {"name": "pstats", "arg_names": [], "import_names": ["pstats"], "rhs_call_name": "", "annotation": ""}, "snippet": " import pstats"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L78_C2", "label": "StringIO import StringIO", "type": "import", "loc": [78, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [1, 1, 0.7723, 0.0099, 1, 0.6, 0.2143, 609, 0, 1, 0, 0, 609, 0, 0], "semantic": {"name": "StringIO", "arg_names": [], "import_names": ["StringIO"], "rhs_call_name": "", "annotation": ""}, "snippet": " import StringIO"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L80_C2", "label": "prof = Profile()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [14, 1, 0.7921, 0.0099, 1, 0.6, 0.2857, 301, 3, 0, 0, 0, 555, 10, 1], "semantic": {"name": "prof", "arg_names": [], "import_names": [], "rhs_call_name": "Profile", "annotation": ""}, "snippet": " prof = cProfile.Profile()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L81_C2", "label": "prof = runctx()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [14, 1, 0.802, 0.0099, 1, 0.6, 0.3571, 301, 3, 3, 0, 0, 364, 10, 3], "semantic": {"name": "prof", "arg_names": [], "import_names": [], "rhs_call_name": "runctx", "annotation": ""}, "snippet": " prof = prof.runctx('real_main()', globals(), locals())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L82_C2", "label": "stream = StringIO()", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [14, 1, 0.8119, 0.0099, 1, 0.6, 0.4286, 517, 3, 0, 0, 0, 609, 10, 1], "semantic": {"name": "stream", "arg_names": [], "import_names": [], "rhs_call_name": "StringIO", "annotation": ""}, "snippet": " stream = StringIO.StringIO()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L83_C2", "label": "stats = Stats()", "type": "assigned_variable", "loc": [83, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [14, 1, 0.8218, 0.0099, 1, 0.6, 0.5, 318, 3, 2, 0, 0, 458, 10, 1], "semantic": {"name": "stats", "arg_names": [], "import_names": [], "rhs_call_name": "Stats", "annotation": ""}, "snippet": " stats = pstats.Stats(prof, stream=stream)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L85_C2", "label": "sort_stats()", "type": "expression", "loc": [85, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.8416, 0.0099, 1, 0.6, 0.5714, 392, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort_stats", "arg_names": [], "import_names": [], "rhs_call_name": "sort_stats", "annotation": ""}, "snippet": " stats.sort_stats('time') # 'time', 'cumulative' or 'calls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L86_C2", "label": "print_stats()", "type": "expression", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.8515, 0.0099, 1, 0.6, 0.6429, 764, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "print_stats", "arg_names": [], "import_names": [], "rhs_call_name": "print_stats", "annotation": ""}, "snippet": " stats.print_stats() # Optional arg: how many to print"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L90_C2", "label": "print()", "type": "expression", "loc": [90, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.8911, 0.0099, 1, 0.6, 0.7143, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('\\n<hr>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L91_C2", "label": "print()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.901, 0.0099, 1, 0.6, 0.7857, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('<h1>Profile</h1>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L92_C2", "label": "print()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.9109, 0.0099, 1, 0.6, 0.8571, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('<pre>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L93_C2", "label": "print()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.9208, 0.0099, 1, 0.6, 0.9286, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(stream.getvalue()[:1000000])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L94_C2", "label": "print()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "vector": [8, 1, 0.9307, 0.0099, 1, 0.6, 1.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('</pre>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L97_C0", "label": "main =", "type": "assigned_variable", "loc": [97, 97], "level": 0, "parent": null, "vector": [14, 0, 0.9604, 0.0099, 0, 0.66, 0.95, 624, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "main = real_main"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:If_L100_C0", "label": "if", "type": "if", "loc": [100, 101], "level": 0, "parent": null, "vector": [4, 0, 0.995, 0.0198, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L101_C2", "label": "main()", "type": "expression", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1171:If_L100_C0", "vector": [8, 1, 1.0, 0.0099, 1, 0.62, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L68_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Import_L78_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Assign_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:FunctionDef_L74_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1171:If_L100_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1171:Expr_L101_C2"}] |
# Removes duplicate nicknames (issue99).
#
# To run this script:
# - Make sure App Engine library (incl. yaml) is in PYTHONPATH.
# - Make sure that the remote API is included in app.yaml.
# - Run "tools/appengine_console.py APP_ID".
# - Import this module.
# - update_accounts.run() updates accounts.
# - Use the other two functions to fetch accounts or find duplicates
# without any changes to the datastore.
from google.appengine.ext import db
from codereview import models
def fetch_accounts():
query = models.Account.all()
accounts = {}
results = query.fetch(100)
while results:
last = None
for account in results:
if account.lower_nickname in accounts:
accounts[account.lower_nickname].append(account)
else:
accounts[account.lower_nickname] = [account]
last = account
if last is None:
break
results = models.Account.all().filter('__key__ >',
last.key()).fetch(100)
return accounts
def find_duplicates(accounts):
tbd = []
while accounts:
_, entries = accounts.popitem()
if len(entries) > 1:
# update accounts, except the fist: it's the lucky one
for num, account in enumerate(entries[1:]):
account.nickname = '%s%d' % (account.nickname, num+1)
account.lower_nickname = account.nickname.lower()
account.fresh = True # display "change nickname..."
tbd.append(account)
return tbd
def run():
accounts = fetch_accounts()
print '%d accounts fetched' % len(accounts)
tbd = find_duplicates(accounts)
print 'Updating %d accounts' % len(tbd)
db.put(tbd)
print 'Updated accounts:'
for account in tbd:
print ' %s' % account.email
| ajibawa-2023/Python-Code-Large/train/row_1172 | 36 | 62 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1172:ImportFrom_L13_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [13, 13], "level": 0, "parent": null, "vector": [1, 0, 0.2097, 0.0161, 0, 0.66, 0.0, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:ImportFrom_L15_C0", "label": "from codereview import models", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.2419, 0.0161, 0, 0.66, 0.25, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "label": "fetch_accounts", "type": "function", "loc": [18, 34], "level": 0, "parent": null, "vector": [2, 0, 0.4194, 0.2742, 0, 0.66, 0.5, 838, 0, 0, 1, 0, 0, 0, 7], "semantic": {"name": "fetch_accounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def fetch_accounts():\n query = models.Account.all()\n accounts = {}\n results = query.fetch(100)\n while results:\n last = None\n for account in results:\n if account.lower_nickname in accounts:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L19_C4", "label": "query = all()", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "vector": [14, 1, 0.3065, 0.0161, 1, 0.22, 0.0, 546, 3, 0, 0, 0, 895, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "all", "annotation": ""}, "snippet": " query = models.Account.all()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L20_C4", "label": "accounts =", "type": "assigned_variable", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "vector": [14, 1, 0.3226, 0.0161, 1, 0.22, 0.25, 729, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "accounts", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " accounts = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L21_C4", "label": "results = fetch()", "type": "assigned_variable", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "vector": [14, 1, 0.3387, 0.0161, 1, 0.22, 0.5, 143, 3, 1, 0, 0, 587, 10, 1], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " results = query.fetch(100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "label": "while", "type": "while", "loc": [22, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "vector": [5, 1, 0.4435, 0.1935, 1, 0.22, 0.75, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while results:\n last = None\n for account in results:\n if account.lower_nickname in accounts:\n accounts[account.lower_nickname].append(account)\n else:\n accounts[account.lower_nickname] = [account]\n last = account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L23_C8", "label": "last =", "type": "assigned_variable", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "vector": [14, 2, 0.371, 0.0161, 2, 0.86, 0.0, 95, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8", "label": "for account", "type": "for", "loc": [24, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "vector": [6, 2, 0.4274, 0.0968, 2, 0.86, 0.3333, 492, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for account in results:\n if account.lower_nickname in accounts:\n accounts[account.lower_nickname].append(account)\n else:\n accounts[account.lower_nickname] = [account]\n last = account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12", "label": "if", "type": "if", "loc": [25, 28], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8", "vector": [4, 3, 0.4274, 0.0645, 3, 0.41, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if account.lower_nickname in accounts:\n accounts[account.lower_nickname].append(account)\n else:\n accounts[account.lower_nickname] = [account]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L26_C16", "label": "append()", "type": "expression", "loc": [26, 26], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12", "vector": [8, 4, 0.4194, 0.0161, 4, 0.15, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " accounts[account.lower_nickname].append(account)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L28_C16", "label": "assign", "type": "assigned_variable", "loc": [28, 28], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12", "vector": [14, 4, 0.4516, 0.0161, 4, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " accounts[account.lower_nickname] = [account]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L29_C12", "label": "last =", "type": "assigned_variable", "loc": [29, 29], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8", "vector": [14, 3, 0.4677, 0.0161, 3, 0.41, 1.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L30_C8", "label": "if", "type": "if", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "vector": [4, 2, 0.4919, 0.0323, 2, 0.86, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if last is None:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L32_C8", "label": "results = fetch()", "type": "assigned_variable", "loc": [32, 33], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "vector": [14, 2, 0.5242, 0.0323, 2, 0.86, 1.0, 143, 3, 1, 0, 0, 587, 10, 4], "semantic": {"name": "results", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " results = models.Account.all().filter('__key__ >',\n last.key()).fetch(100)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Return_L34_C4", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "vector": [13, 1, 0.5484, 0.0161, 1, 0.22, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return accounts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "label": "find_duplicates", "type": "function", "loc": [37, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6855, 0.1935, 0, 0.66, 0.75, 527, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "find_duplicates", "arg_names": ["accounts"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def find_duplicates(accounts):\n tbd = []\n while accounts:\n _, entries = accounts.popitem()\n if len(entries) > 1:\n # update accounts, except the fist: it's the lucky one\n for num, account in enumerate(entries[1:]):\n account.nickname = '%s%d' % (account.nickname, num+1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L38_C4", "label": "tbd =", "type": "assigned_variable", "loc": [38, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "vector": [14, 1, 0.6129, 0.0161, 1, 0.58, 0.0, 69, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "tbd", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tbd = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4", "label": "while", "type": "while", "loc": [39, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "vector": [5, 1, 0.6935, 0.1452, 1, 0.58, 0.5, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while accounts:\n _, entries = accounts.popitem()\n if len(entries) > 1:\n # update accounts, except the fist: it's the lucky one\n for num, account in enumerate(entries[1:]):\n account.nickname = '%s%d' % (account.nickname, num+1)\n account.lower_nickname = account.nickname.lower()\n account.fresh = True # display \"change nickname...\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L40_C8", "label": "_, entries = popitem()", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4", "vector": [14, 2, 0.6452, 0.0161, 2, 0.35, 0.0, 521, 3, 0, 0, 0, 553, 10, 1], "semantic": {"name": "_, entries", "arg_names": [], "import_names": [], "rhs_call_name": "popitem", "annotation": ""}, "snippet": " _, entries = accounts.popitem()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L41_C8", "label": "if", "type": "if", "loc": [41, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4", "vector": [4, 2, 0.7097, 0.1129, 2, 0.35, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(entries) > 1:\n # update accounts, except the fist: it's the lucky one\n for num, account in enumerate(entries[1:]):\n account.nickname = '%s%d' % (account.nickname, num+1)\n account.lower_nickname = account.nickname.lower()\n account.fresh = True # display \"change nickname...\"\n tbd.append(account)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "label": "for num, account", "type": "for", "loc": [43, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L41_C8", "vector": [6, 3, 0.7258, 0.0806, 3, 0.81, 0.0, 555, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "num, account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for num, account in enumerate(entries[1:]):\n account.nickname = '%s%d' % (account.nickname, num+1)\n account.lower_nickname = account.nickname.lower()\n account.fresh = True # display \"change nickname...\"\n tbd.append(account)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L44_C16", "label": "account.nickname =", "type": "assigned_variable", "loc": [44, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "vector": [14, 4, 0.7097, 0.0161, 4, 0.58, 0.0, 750, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "account.nickname", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " account.nickname = '%s%d' % (account.nickname, num+1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L45_C16", "label": "account.lower_nickname = lower()", "type": "assigned_variable", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "vector": [14, 4, 0.7258, 0.0161, 4, 0.58, 0.3333, 800, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "account.lower_nickname", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " account.lower_nickname = account.nickname.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L46_C16", "label": "account.fresh =", "type": "assigned_variable", "loc": [46, 46], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "vector": [14, 4, 0.7419, 0.0161, 4, 0.58, 0.6667, 973, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "account.fresh", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " account.fresh = True # display \"change nickname...\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L47_C16", "label": "append()", "type": "expression", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "vector": [8, 4, 0.7581, 0.0161, 4, 0.58, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " tbd.append(account)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Return_L48_C4", "label": "return", "type": "return", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "vector": [13, 1, 0.7742, 0.0161, 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 tbd"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "label": "run", "type": "function", "loc": [51, 62], "level": 0, "parent": null, "vector": [2, 0, 0.9113, 0.1935, 0, 0.66, 1.0, 679, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "run", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def run():\n accounts = fetch_accounts()\n print('%d accounts fetched' % len(accounts))\n\n tbd = find_duplicates(accounts)\n print('Updating %d accounts' % len(tbd))\n\n db.put(tbd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L52_C4", "label": "accounts = fetch_accounts()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [14, 1, 0.8387, 0.0161, 1, 0.02, 0.0, 729, 3, 0, 0, 0, 838, 10, 1], "semantic": {"name": "accounts", "arg_names": [], "import_names": [], "rhs_call_name": "fetch_accounts", "annotation": ""}, "snippet": " accounts = fetch_accounts()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L53_C4", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [8, 1, 0.8548, 0.0161, 1, 0.02, 0.1667, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%d accounts fetched' % len(accounts))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L55_C4", "label": "tbd = find_duplicates()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [14, 1, 0.8871, 0.0161, 1, 0.02, 0.3333, 69, 3, 1, 0, 0, 527, 10, 1], "semantic": {"name": "tbd", "arg_names": [], "import_names": [], "rhs_call_name": "find_duplicates", "annotation": ""}, "snippet": " tbd = find_duplicates(accounts)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L56_C4", "label": "print()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [8, 1, 0.9032, 0.0161, 1, 0.02, 0.5, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Updating %d accounts' % len(tbd))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L58_C4", "label": "put()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [8, 1, 0.9355, 0.0161, 1, 0.02, 0.6667, 636, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "put", "arg_names": [], "import_names": [], "rhs_call_name": "put", "annotation": ""}, "snippet": " db.put(tbd)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L60_C4", "label": "print()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [8, 1, 0.9677, 0.0161, 1, 0.02, 0.8333, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('Updated accounts:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L61_C4", "label": "for account", "type": "for", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "vector": [6, 1, 0.9919, 0.0323, 1, 0.02, 1.0, 492, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for account in tbd:\n print(' %s' % account.email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L62_C8", "label": "print()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L61_C4", "vector": [8, 2, 1.0, 0.0161, 2, 0.71, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(' %s' % account.email)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L23_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L26_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L25_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L28_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L24_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L29_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L32_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Return_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L40_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:While_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L41_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:If_L41_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L44_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L45_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L46_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L43_C12", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L47_C16"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Return_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:FunctionDef_L51_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1172:For_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1172:Expr_L62_C8"}] |
"""Configuration."""
import logging
import os
import re
from google.appengine.ext.appstats import recording
logging.info('Loading %s from %s', __name__, __file__)
# Custom webapp middleware to add Appstats.
def webapp_add_wsgi_middleware(app):
app = recording.appstats_wsgi_middleware(app)
return app
# Custom Appstats path normalization.
def appstats_normalize_path(path):
if path.startswith('/user/'):
return '/user/X'
if path.startswith('/user_popup/'):
return '/user_popup/X'
if '/diff/' in path:
return '/X/diff/...'
if '/diff2/' in path:
return '/X/diff2/...'
if '/patch/' in path:
return '/X/patch/...'
if path.startswith('/rss/'):
i = path.find('/', 5)
if i > 0:
return path[:i] + '/X'
return re.sub(r'\d+', 'X', path)
# Segregate Appstats by runtime (python vs. python27).
appstats_KEY_NAMESPACE = '__appstats_%s__' % os.getenv('APPENGINE_RUNTIME')
# Django 1.2+ requires DJANGO_SETTINGS_MODULE environment variable to be set
# http://code.google.com/appengine/docs/python/tools/libraries.html#Django
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
# NOTE: All "main" scripts must import webapp.template before django.
| ajibawa-2023/Python-Code-Large/train/row_1173 | 27 | 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_1173:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Configuration.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Import_L3_C0", "label": "logging import logging", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0732, 0.0244, 0, 0.66, 0.1111, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Import_L4_C0", "label": "os import os", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0976, 0.0244, 0, 0.66, 0.2222, 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_1173:Import_L5_C0", "label": "re import re", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.122, 0.0244, 0, 0.66, 0.3333, 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_1173:ImportFrom_L7_C0", "label": "from google.appengine.ext.appstats import recording", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.1707, 0.0244, 0, 0.66, 0.4444, 215, 0, 1, 0, 0, 215, 0, 0], "semantic": {"name": "google.appengine.ext.appstats", "arg_names": [], "import_names": ["recording"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.appstats import recording"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Expr_L9_C0", "label": "info()", "type": "expression", "loc": [9, 9], "level": 0, "parent": null, "vector": [8, 0, 0.2195, 0.0244, 0, 0.66, 0.5556, 730, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "info", "arg_names": [], "import_names": [], "rhs_call_name": "info", "annotation": ""}, "snippet": "logging.info('Loading %s from %s', __name__, __file__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L12_C0", "label": "webapp_add_wsgi_middleware", "type": "function", "loc": [12, 14], "level": 0, "parent": null, "vector": [2, 0, 0.3171, 0.0732, 0, 0.66, 0.6667, 156, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "webapp_add_wsgi_middleware", "arg_names": ["app"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def webapp_add_wsgi_middleware(app):\n app = recording.appstats_wsgi_middleware(app)\n return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L13_C2", "label": "app = appstats_wsgi_middleware()", "type": "assigned_variable", "loc": [13, 13], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L12_C0", "vector": [14, 1, 0.3171, 0.0244, 1, 0.14, 0.0, 494, 3, 1, 0, 0, 631, 10, 1], "semantic": {"name": "app", "arg_names": [], "import_names": [], "rhs_call_name": "appstats_wsgi_middleware", "annotation": ""}, "snippet": " app = recording.appstats_wsgi_middleware(app)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L14_C2", "label": "return", "type": "return", "loc": [14, 14], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L12_C0", "vector": [13, 1, 0.3415, 0.0244, 1, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return app"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "label": "appstats_normalize_path", "type": "function", "loc": [17, 32], "level": 0, "parent": null, "vector": [2, 0, 0.5976, 0.3902, 0, 0.66, 0.7778, 41, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "appstats_normalize_path", "arg_names": ["path"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def appstats_normalize_path(path):\n if path.startswith('/user/'):\n return '/user/X'\n if path.startswith('/user_popup/'):\n return '/user_popup/X'\n if '/diff/' in path:\n return '/X/diff/...'\n if '/diff2/' in path:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L18_C4", "label": "if", "type": "if", "loc": [18, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.4512, 0.0488, 1, 0.62, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path.startswith('/user/'):\n return '/user/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L19_C8", "label": "return", "type": "return", "loc": [19, 19], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L18_C4", "vector": [13, 2, 0.4634, 0.0244, 2, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '/user/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L20_C4", "label": "if", "type": "if", "loc": [20, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.5, 0.0488, 1, 0.62, 0.1667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path.startswith('/user_popup/'):\n return '/user_popup/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L21_C8", "label": "return", "type": "return", "loc": [21, 21], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L20_C4", "vector": [13, 2, 0.5122, 0.0244, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '/user_popup/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.5488, 0.0488, 1, 0.62, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '/diff/' in path:\n return '/X/diff/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L23_C6", "label": "return", "type": "return", "loc": [23, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L22_C4", "vector": [13, 2, 0.561, 0.0244, 2, 0.17, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '/X/diff/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L24_C4", "label": "if", "type": "if", "loc": [24, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.5976, 0.0488, 1, 0.62, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '/diff2/' in path:\n return '/X/diff2/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L25_C6", "label": "return", "type": "return", "loc": [25, 25], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L24_C4", "vector": [13, 2, 0.6098, 0.0244, 2, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '/X/diff2/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L26_C4", "label": "if", "type": "if", "loc": [26, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.6463, 0.0488, 1, 0.62, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if '/patch/' in path:\n return '/X/patch/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L27_C6", "label": "return", "type": "return", "loc": [27, 27], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L26_C4", "vector": [13, 2, 0.6585, 0.0244, 2, 0.46, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '/X/patch/...'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4", "label": "if", "type": "if", "loc": [28, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [4, 1, 0.7195, 0.0976, 1, 0.62, 0.8333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path.startswith('/rss/'):\n i = path.find('/', 5)\n if i > 0:\n return path[:i] + '/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L29_C8", "label": "i = find()", "type": "assigned_variable", "loc": [29, 29], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4", "vector": [14, 2, 0.7073, 0.0244, 2, 0.44, 0.0, 826, 3, 2, 0, 0, 340, 10, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " i = path.find('/', 5)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L30_C8", "label": "if", "type": "if", "loc": [30, 31], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4", "vector": [4, 2, 0.7439, 0.0488, 2, 0.44, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i > 0:\n return path[:i] + '/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L31_C12", "label": "return", "type": "return", "loc": [31, 31], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L30_C8", "vector": [13, 3, 0.7561, 0.0244, 3, 0.48, 0.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return path[:i] + '/X'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L32_C4", "label": "return", "type": "return", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "vector": [13, 1, 0.7805, 0.0244, 1, 0.62, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return re.sub(r'\\d+', 'X', path)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L35_C0", "label": "appstats_KEY_NAMESPACE =", "type": "assigned_variable", "loc": [35, 35], "level": 0, "parent": null, "vector": [14, 0, 0.8537, 0.0244, 0, 0.66, 0.8889, 176, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "appstats_KEY_NAMESPACE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "appstats_KEY_NAMESPACE = '__appstats_%s__' % os.getenv('APPENGINE_RUNTIME')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L39_C0", "label": "assign", "type": "assigned_variable", "loc": [39, 39], "level": 0, "parent": null, "vector": [14, 0, 0.9512, 0.0244, 0, 0.66, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L13_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L14_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L18_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L19_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L20_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L21_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L24_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L25_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L27_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Assign_L29_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L28_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L30_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:If_L30_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L31_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1173:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1173:Return_L32_C4"}] |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test utils."""
import os
from google.appengine.ext import testbed
from django.test import TestCase as _TestCase
FILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'files')
class TestCase(_TestCase):
"""Customized Django TestCase.
This class disables the setup of Django features that are not
available on App Engine (e.g. fixture loading). And it initializes
the Testbad class provided by the App Engine SDK.
"""
def _fixture_setup(self): # defined in django.test.TestCase
pass
def _fixture_teardown(self): # defined in django.test.TestCase
pass
def setUp(self):
super(TestCase, self).setUp()
self.testbed = testbed.Testbed()
self.testbed.activate()
self.testbed.init_datastore_v3_stub()
self.testbed.init_user_stub()
def tearDown(self):
self.testbed.deactivate()
super(TestCase, self).tearDown()
def login(self, email):
"""Logs in a user identified by email."""
os.environ['USER_EMAIL'] = email
def logout(self):
"""Logs the user out."""
os.environ['USER_EMAIL'] = ''
def load_file(fname):
"""Read file and return it's content."""
return open(os.path.join(FILES_DIR, fname)).read()
| ajibawa-2023/Python-Code-Large/train/row_1174 | 27 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.2381, 0.0159, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Test utils.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Import_L17_C0", "label": "os import os", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2698, 0.0159, 0, 0.66, 0.1667, 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_1174:ImportFrom_L19_C0", "label": "from google.appengine.ext import testbed", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.3016, 0.0159, 0, 0.66, 0.3333, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["testbed"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import testbed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:ImportFrom_L21_C0", "label": "from django.test import _TestCase", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.3333, 0.0159, 0, 0.66, 0.5, 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 as _TestCase"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L24_C0", "label": "FILES_DIR = join()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.381, 0.0159, 0, 0.66, 0.6667, 427, 3, 2, 0, 0, 933, 10, 3], "semantic": {"name": "FILES_DIR", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "FILES_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'files')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "label": "TestCase", "type": "class", "loc": [27, 58], "level": 0, "parent": null, "vector": [3, 0, 0.6746, 0.5079, 0, 0.66, 0.8333, 3, 0, 6, 0, 0, 56, 0, 9], "semantic": {"name": "TestCase", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class TestCase(_TestCase):\n \"\"\"Customized Django TestCase.\n\n This class disables the setup of Django features that are not\n available on App Engine (e.g. fixture loading). And it initializes\n the Testbad class provided by the App Engine SDK.\n \"\"\"\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L28_C2", "label": "expression", "type": "expression", "loc": [28, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [8, 1, 0.4841, 0.0952, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Customized Django TestCase.\n\n This class disables the setup of Django features that are not\n available on App Engine (e.g. fixture loading). And it initializes\n the Testbad class provided by the App Engine SDK.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L35_C2", "label": "_fixture_setup", "type": "function", "loc": [35, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.5635, 0.0317, 1, 0.34, 0.1667, 173, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_fixture_setup", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixture_setup(self): # defined in django.test.TestCase\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L38_C2", "label": "_fixture_teardown", "type": "function", "loc": [38, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.6111, 0.0317, 1, 0.34, 0.3333, 656, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "_fixture_teardown", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _fixture_teardown(self): # defined in django.test.TestCase\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "label": "setUp", "type": "function", "loc": [41, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.6905, 0.0952, 1, 0.34, 0.5, 952, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "setUp", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def setUp(self):\n super(TestCase, self).setUp()\n self.testbed = testbed.Testbed()\n self.testbed.activate()\n self.testbed.init_datastore_v3_stub()\n self.testbed.init_user_stub()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L42_C4", "label": "setUp()", "type": "expression", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "vector": [8, 2, 0.6667, 0.0159, 2, 0.17, 0.0, 952, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "setUp", "arg_names": [], "import_names": [], "rhs_call_name": "setUp", "annotation": ""}, "snippet": " super(TestCase, self).setUp()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L43_C4", "label": "self.testbed = Testbed()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "vector": [14, 2, 0.6825, 0.0159, 2, 0.17, 0.25, 209, 3, 0, 0, 0, 350, 10, 1], "semantic": {"name": "self.testbed", "arg_names": [], "import_names": [], "rhs_call_name": "Testbed", "annotation": ""}, "snippet": " self.testbed = testbed.Testbed()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L44_C4", "label": "activate()", "type": "expression", "loc": [44, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "vector": [8, 2, 0.6984, 0.0159, 2, 0.17, 0.5, 177, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "activate", "arg_names": [], "import_names": [], "rhs_call_name": "activate", "annotation": ""}, "snippet": " self.testbed.activate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L45_C4", "label": "init_datastore_v3_stub()", "type": "expression", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "vector": [8, 2, 0.7143, 0.0159, 2, 0.17, 0.75, 386, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init_datastore_v3_stub", "arg_names": [], "import_names": [], "rhs_call_name": "init_datastore_v3_stub", "annotation": ""}, "snippet": " self.testbed.init_datastore_v3_stub()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L46_C4", "label": "init_user_stub()", "type": "expression", "loc": [46, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "vector": [8, 2, 0.7302, 0.0159, 2, 0.17, 1.0, 708, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "init_user_stub", "arg_names": [], "import_names": [], "rhs_call_name": "init_user_stub", "annotation": ""}, "snippet": " self.testbed.init_user_stub()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2", "label": "tearDown", "type": "function", "loc": [48, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.7778, 0.0476, 1, 0.34, 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 self.testbed.deactivate()\n super(TestCase, self).tearDown()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L49_C4", "label": "deactivate()", "type": "expression", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2", "vector": [8, 2, 0.7778, 0.0159, 2, 0.83, 0.0, 499, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "deactivate", "arg_names": [], "import_names": [], "rhs_call_name": "deactivate", "annotation": ""}, "snippet": " self.testbed.deactivate()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L50_C4", "label": "tearDown()", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2", "vector": [8, 2, 0.7937, 0.0159, 2, 0.83, 1.0, 530, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tearDown", "arg_names": [], "import_names": [], "rhs_call_name": "tearDown", "annotation": ""}, "snippet": " super(TestCase, self).tearDown()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2", "label": "login", "type": "function", "loc": [52, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.8413, 0.0476, 1, 0.34, 0.8333, 724, 0, 2, 0, 0, 0, 0, 0], "semantic": {"name": "login", "arg_names": ["self", "email"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def login(self, email):\n \"\"\"Logs in a user identified by email.\"\"\"\n os.environ['USER_EMAIL'] = email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L53_C4", "label": "expression", "type": "expression", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2", "vector": [8, 2, 0.8413, 0.0159, 2, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Logs in a user identified by email.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L54_C4", "label": "assign", "type": "assigned_variable", "loc": [54, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2", "vector": [14, 2, 0.8571, 0.0159, 2, 0.4, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os.environ['USER_EMAIL'] = email"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2", "label": "logout", "type": "function", "loc": [56, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "vector": [2, 1, 0.9048, 0.0476, 1, 0.34, 1.0, 525, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "logout", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def logout(self):\n \"\"\"Logs the user out.\"\"\"\n os.environ['USER_EMAIL'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L57_C4", "label": "expression", "type": "expression", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2", "vector": [8, 2, 0.9048, 0.0159, 2, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Logs the user out.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L58_C4", "label": "assign", "type": "assigned_variable", "loc": [58, 58], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2", "vector": [14, 2, 0.9206, 0.0159, 2, 0.71, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os.environ['USER_EMAIL'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L61_C0", "label": "load_file", "type": "function", "loc": [61, 63], "level": 0, "parent": null, "vector": [2, 0, 0.9841, 0.0476, 0, 0.66, 1.0, 679, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "load_file", "arg_names": ["fname"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def load_file(fname):\n \"\"\"Read file and return it's content.\"\"\"\n return open(os.path.join(FILES_DIR, fname)).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L62_C2", "label": "expression", "type": "expression", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L61_C0", "vector": [8, 1, 0.9841, 0.0159, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Read file and return it's content.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1174:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L61_C0", "vector": [13, 1, 1.0, 0.0159, 1, 0.78, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return open(os.path.join(FILES_DIR, fname)).read()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L44_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L41_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L54_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Assign_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1174:FunctionDef_L61_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1174:Return_L63_C2"}] |
#!/usr/bin/env python
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import code
import getpass
import logging
import optparse
import os
import re
import sys
ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
LIB = os.path.join(ROOT, '..', 'google_appengine', 'lib')
sys.path.insert(0, os.path.join(ROOT, '..', 'google_appengine'))
sys.path.append(os.path.join(LIB, 'django_1_2'))
sys.path.append(os.path.join(LIB, 'fancy_urllib'))
sys.path.append(os.path.join(LIB, 'simplejson'))
sys.path.append(os.path.join(LIB, 'webob'))
sys.path.append(os.path.join(LIB, 'yaml', 'lib'))
sys.path.append(ROOT)
from google.appengine.ext.remote_api import remote_api_stub
import yaml
def default_auth_func():
user = os.environ.get('EMAIL_ADDRESS')
if user:
print('User: %s' % user)
else:
user = raw_input('Username:')
return user, getpass.getpass('Password:')
def smart_auth_func():
"""Try to guess first."""
try:
return os.environ['EMAIL_ADDRESS'], open('.pwd').readline().strip()
except (KeyError, IOError):
return default_auth_func()
def default_app_id(directory):
return yaml.load(open(os.path.join(directory, 'app.yaml')))['application']
def setup_env(app_id, host=None, auth_func=None):
"""Setup remote access to a GAE instance."""
auth_func = auth_func or smart_auth_func
host = host or '%s.appspot.com' % app_id
# pylint: disable=W0612
from google.appengine.api import memcache
from google.appengine.api.users import User
from google.appengine.ext import db
remote_api_stub.ConfigureRemoteDatastore(
app_id, '/_ah/remote_api', auth_func, host)
# Initialize environment.
os.environ['SERVER_SOFTWARE'] = ''
import appengine_config
# Create shortcuts.
import codereview
from codereview import models, views
# Symbols presented to the user.
predefined_vars = locals().copy()
del predefined_vars['appengine_config']
del predefined_vars['auth_func']
# Load all the models.
for i in dir(models):
if re.match(r'[A-Z][a-z]', i[:2]):
predefined_vars[i] = getattr(models, i)
return predefined_vars
def main():
parser = optparse.OptionParser()
parser.add_option('-v', '--verbose', action='count')
options, args = parser.parse_args()
if not args:
app_id = default_app_id(ROOT)
else:
app_id = args[0]
host = None
if len(args) > 1:
host = args[1]
if options.verbose:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.ERROR)
predefined_vars = setup_env(app_id, host)
prompt = (
'App Engine interactive console for "%s".\n'
'Available symbols:\n'
' %s\n') % (app_id, ', '.join(sorted(predefined_vars)))
code.interact(prompt, None, predefined_vars)
if __name__ == '__main__':
sys.exit(main())
| ajibawa-2023/Python-Code-Large/train/row_1177 | 66 | 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_1177:Import_L16_C0", "label": "code import code", "type": "import", "loc": [16, 16], "level": 0, "parent": null, "vector": [1, 0, 0.1345, 0.0084, 0, 0.66, 0.0, 44, 0, 1, 0, 0, 44, 0, 0], "semantic": {"name": "code", "arg_names": [], "import_names": ["code"], "rhs_call_name": "", "annotation": ""}, "snippet": "import code"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L17_C0", "label": "getpass import getpass", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1429, 0.0084, 0, 0.66, 0.0435, 784, 0, 1, 0, 0, 784, 0, 0], "semantic": {"name": "getpass", "arg_names": [], "import_names": ["getpass"], "rhs_call_name": "", "annotation": ""}, "snippet": "import getpass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L18_C0", "label": "logging import logging", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1513, 0.0084, 0, 0.66, 0.087, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L19_C0", "label": "optparse import optparse", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1597, 0.0084, 0, 0.66, 0.1304, 323, 0, 1, 0, 0, 323, 0, 0], "semantic": {"name": "optparse", "arg_names": [], "import_names": ["optparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import optparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L20_C0", "label": "os import os", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1681, 0.0084, 0, 0.66, 0.1739, 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_1177:Import_L21_C0", "label": "re import re", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.1765, 0.0084, 0, 0.66, 0.2174, 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_1177:Import_L22_C0", "label": "sys import sys", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.1849, 0.0084, 0, 0.66, 0.2609, 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_1177:Assign_L24_C0", "label": "ROOT = join()", "type": "assigned_variable", "loc": [24, 24], "level": 0, "parent": null, "vector": [14, 0, 0.2017, 0.0084, 0, 0.66, 0.3043, 986, 3, 2, 0, 0, 933, 10, 3], "semantic": {"name": "ROOT", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L25_C0", "label": "LIB = join()", "type": "assigned_variable", "loc": [25, 25], "level": 0, "parent": null, "vector": [14, 0, 0.2101, 0.0084, 0, 0.66, 0.3478, 921, 3, 4, 0, 0, 933, 10, 1], "semantic": {"name": "LIB", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "LIB = os.path.join(ROOT, '..', 'google_appengine', 'lib')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L26_C0", "label": "insert()", "type": "expression", "loc": [26, 26], "level": 0, "parent": null, "vector": [8, 0, 0.2185, 0.0084, 0, 0.66, 0.3913, 368, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "insert", "arg_names": [], "import_names": [], "rhs_call_name": "insert", "annotation": ""}, "snippet": "sys.path.insert(0, os.path.join(ROOT, '..', 'google_appengine'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L27_C0", "label": "append()", "type": "expression", "loc": [27, 27], "level": 0, "parent": null, "vector": [8, 0, 0.2269, 0.0084, 0, 0.66, 0.4348, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(os.path.join(LIB, 'django_1_2'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L28_C0", "label": "append()", "type": "expression", "loc": [28, 28], "level": 0, "parent": null, "vector": [8, 0, 0.2353, 0.0084, 0, 0.66, 0.4783, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(os.path.join(LIB, 'fancy_urllib'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L29_C0", "label": "append()", "type": "expression", "loc": [29, 29], "level": 0, "parent": null, "vector": [8, 0, 0.2437, 0.0084, 0, 0.66, 0.5217, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(os.path.join(LIB, 'simplejson'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L30_C0", "label": "append()", "type": "expression", "loc": [30, 30], "level": 0, "parent": null, "vector": [8, 0, 0.2521, 0.0084, 0, 0.66, 0.5652, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(os.path.join(LIB, 'webob'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L31_C0", "label": "append()", "type": "expression", "loc": [31, 31], "level": 0, "parent": null, "vector": [8, 0, 0.2605, 0.0084, 0, 0.66, 0.6087, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(os.path.join(LIB, 'yaml', 'lib'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L32_C0", "label": "append()", "type": "expression", "loc": [32, 32], "level": 0, "parent": null, "vector": [8, 0, 0.2689, 0.0084, 0, 0.66, 0.6522, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": "sys.path.append(ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L34_C0", "label": "from google.appengine.ext.remote_api import remote_api_stub", "type": "import", "loc": [34, 34], "level": 0, "parent": null, "vector": [1, 0, 0.2857, 0.0084, 0, 0.66, 0.6957, 61, 0, 1, 0, 0, 61, 0, 0], "semantic": {"name": "google.appengine.ext.remote_api", "arg_names": [], "import_names": ["remote_api_stub"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext.remote_api import remote_api_stub"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L35_C0", "label": "yaml import yaml", "type": "import", "loc": [35, 35], "level": 0, "parent": null, "vector": [1, 0, 0.2941, 0.0084, 0, 0.66, 0.7391, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "yaml", "arg_names": [], "import_names": ["yaml"], "rhs_call_name": "", "annotation": ""}, "snippet": "import yaml"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "label": "default_auth_func", "type": "function", "loc": [38, 44], "level": 0, "parent": null, "vector": [2, 0, 0.3445, 0.0588, 0, 0.66, 0.7826, 707, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "default_auth_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def default_auth_func():\n user = os.environ.get('EMAIL_ADDRESS')\n if user:\n print('User: %s' % user)\n else:\n user = raw_input('Username:')\n return user, getpass.getpass('Password:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L39_C2", "label": "user = get()", "type": "assigned_variable", "loc": [39, 39], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "vector": [14, 1, 0.3277, 0.0084, 1, 0.61, 0.0, 503, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " user = os.environ.get('EMAIL_ADDRESS')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2", "label": "if", "type": "if", "loc": [40, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "vector": [4, 1, 0.3487, 0.0336, 1, 0.61, 0.5, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user:\n print('User: %s' % user)\n else:\n user = raw_input('Username:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L41_C4", "label": "print()", "type": "expression", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2", "vector": [8, 2, 0.3445, 0.0084, 2, 0.96, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('User: %s' % user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L43_C4", "label": "user = raw_input()", "type": "assigned_variable", "loc": [43, 43], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2", "vector": [14, 2, 0.3613, 0.0084, 2, 0.96, 1.0, 503, 3, 1, 0, 0, 821, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "raw_input", "annotation": ""}, "snippet": " user = raw_input('Username:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L44_C2", "label": "return", "type": "return", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "vector": [13, 1, 0.3697, 0.0084, 1, 0.61, 1.0, 0, 0, 0, 0, 0, 0, 8, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return user, getpass.getpass('Password:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L47_C0", "label": "smart_auth_func", "type": "function", "loc": [47, 52], "level": 0, "parent": null, "vector": [2, 0, 0.416, 0.0504, 0, 0.66, 0.8261, 27, 0, 0, 1, 0, 0, 0, 4], "semantic": {"name": "smart_auth_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def smart_auth_func():\n \"\"\"Try to guess first.\"\"\"\n try:\n return os.environ['EMAIL_ADDRESS'], open('.pwd').readline().strip()\n except (KeyError, IOError):\n return default_auth_func()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L48_C2", "label": "expression", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L47_C0", "vector": [8, 1, 0.4034, 0.0084, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Try to guess first.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2", "label": "try", "type": "try", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L47_C0", "vector": [7, 1, 0.4244, 0.0336, 1, 0.74, 1.0, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return os.environ['EMAIL_ADDRESS'], open('.pwd').readline().strip()\n except (KeyError, IOError):\n return default_auth_func()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2", "vector": [13, 2, 0.4202, 0.0084, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 8, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return os.environ['EMAIL_ADDRESS'], open('.pwd').readline().strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2", "vector": [13, 2, 0.437, 0.0084, 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 default_auth_func()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L55_C0", "label": "default_app_id", "type": "function", "loc": [55, 56], "level": 0, "parent": null, "vector": [2, 0, 0.4664, 0.0168, 0, 0.66, 0.8696, 478, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "default_app_id", "arg_names": ["directory"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def default_app_id(directory):\n return yaml.load(open(os.path.join(directory, 'app.yaml')))['application']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L56_C2", "label": "return", "type": "return", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L55_C0", "vector": [13, 1, 0.4706, 0.0084, 1, 0.64, 0.0, 0, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return yaml.load(open(os.path.join(directory, 'app.yaml')))['application']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "label": "setup_env", "type": "function", "loc": [59, 88], "level": 0, "parent": null, "vector": [2, 0, 0.6176, 0.2521, 0, 0.66, 0.913, 193, 0, 3, 1, 0, 0, 0, 6], "semantic": {"name": "setup_env", "arg_names": ["app_id", "host", "auth_func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def setup_env(app_id, host=None, auth_func=None):\n \"\"\"Setup remote access to a GAE instance.\"\"\"\n auth_func = auth_func or smart_auth_func\n host = host or '%s.appspot.com' % app_id\n\n # pylint: disable=W0612\n from google.appengine.api import memcache\n from google.appengine.api.users import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L60_C2", "label": "expression", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [8, 1, 0.5042, 0.0084, 1, 0.82, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Setup remote access to a GAE instance.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L61_C2", "label": "auth_func =", "type": "assigned_variable", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [14, 1, 0.5126, 0.0084, 1, 0.82, 0.0769, 605, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "auth_func", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " auth_func = auth_func or smart_auth_func"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L62_C2", "label": "host =", "type": "assigned_variable", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [14, 1, 0.521, 0.0084, 1, 0.82, 0.1538, 867, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = host or '%s.appspot.com' % app_id"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L65_C2", "label": "from google.appengine.api import memcache", "type": "import", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.5462, 0.0084, 1, 0.82, 0.2308, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["memcache"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.api import memcache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L66_C2", "label": "from google.appengine.api.users import User", "type": "import", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.5546, 0.0084, 1, 0.82, 0.3077, 624, 0, 1, 0, 0, 624, 0, 0], "semantic": {"name": "google.appengine.api.users", "arg_names": [], "import_names": ["User"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.api.users import User"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L67_C2", "label": "from google.appengine.ext import db", "type": "import", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.563, 0.0084, 1, 0.82, 0.3846, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": " from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L68_C2", "label": "ConfigureRemoteDatastore()", "type": "expression", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [8, 1, 0.5756, 0.0168, 1, 0.82, 0.4615, 306, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "ConfigureRemoteDatastore", "arg_names": [], "import_names": [], "rhs_call_name": "ConfigureRemoteDatastore", "annotation": ""}, "snippet": " remote_api_stub.ConfigureRemoteDatastore(\n app_id, '/_ah/remote_api', auth_func, host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L72_C2", "label": "assign", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [14, 1, 0.605, 0.0084, 1, 0.82, 0.5385, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " os.environ['SERVER_SOFTWARE'] = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L73_C2", "label": "appengine_config import appengine_config", "type": "import", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.6134, 0.0084, 1, 0.82, 0.6154, 927, 0, 1, 0, 0, 927, 0, 0], "semantic": {"name": "appengine_config", "arg_names": [], "import_names": ["appengine_config"], "rhs_call_name": "", "annotation": ""}, "snippet": " import appengine_config"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L76_C2", "label": "codereview import codereview", "type": "import", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.6387, 0.0084, 1, 0.82, 0.6923, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["codereview"], "rhs_call_name": "", "annotation": ""}, "snippet": " import codereview"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L77_C2", "label": "from codereview import models, views", "type": "import", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [1, 1, 0.6471, 0.0084, 1, 0.82, 0.7692, 844, 0, 2, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models", "views"], "rhs_call_name": "", "annotation": ""}, "snippet": " from codereview import models, views"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L80_C2", "label": "predefined_vars = copy()", "type": "assigned_variable", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [14, 1, 0.6723, 0.0084, 1, 0.82, 0.8462, 658, 3, 0, 0, 0, 739, 10, 2], "semantic": {"name": "predefined_vars", "arg_names": [], "import_names": [], "rhs_call_name": "copy", "annotation": ""}, "snippet": " predefined_vars = locals().copy()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:For_L85_C2", "label": "for i", "type": "for", "loc": [85, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [6, 1, 0.7227, 0.0252, 1, 0.82, 0.9231, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in dir(models):\n if re.match(r'[A-Z][a-z]', i[:2]):\n predefined_vars[i] = getattr(models, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L86_C4", "label": "if", "type": "if", "loc": [86, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:For_L85_C2", "vector": [4, 2, 0.7269, 0.0168, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if re.match(r'[A-Z][a-z]', i[:2]):\n predefined_vars[i] = getattr(models, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L87_C6", "label": " = getattr()", "type": "assigned_variable", "loc": [87, 87], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L86_C4", "vector": [14, 3, 0.7311, 0.0084, 3, 0.35, 0.0, 0, 3, 2, 0, 0, 121, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "getattr", "annotation": ""}, "snippet": " predefined_vars[i] = getattr(models, i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L88_C2", "label": "return", "type": "return", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "vector": [13, 1, 0.7395, 0.0084, 1, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return predefined_vars"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "label": "main", "type": "function", "loc": [91, 115], "level": 0, "parent": null, "vector": [2, 0, 0.8655, 0.2101, 0, 0.66, 0.9565, 624, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n parser = optparse.OptionParser()\n parser.add_option('-v', '--verbose', action='count')\n options, args = parser.parse_args()\n\n if not args:\n app_id = default_app_id(ROOT)\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L92_C2", "label": "parser = OptionParser()", "type": "assigned_variable", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [14, 1, 0.7731, 0.0084, 1, 0.77, 0.0, 968, 3, 0, 0, 0, 894, 10, 1], "semantic": {"name": "parser", "arg_names": [], "import_names": [], "rhs_call_name": "OptionParser", "annotation": ""}, "snippet": " parser = optparse.OptionParser()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L93_C2", "label": "add_option()", "type": "expression", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [8, 1, 0.7815, 0.0084, 1, 0.77, 0.1111, 176, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "add_option", "arg_names": [], "import_names": [], "rhs_call_name": "add_option", "annotation": ""}, "snippet": " parser.add_option('-v', '--verbose', action='count')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L94_C2", "label": "options, args = parse_args()", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [14, 1, 0.7899, 0.0084, 1, 0.77, 0.2222, 584, 3, 0, 0, 0, 187, 10, 1], "semantic": {"name": "options, args", "arg_names": [], "import_names": [], "rhs_call_name": "parse_args", "annotation": ""}, "snippet": " options, args = parser.parse_args()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2", "label": "if", "type": "if", "loc": [96, 99], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [4, 1, 0.8193, 0.0336, 1, 0.77, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not args:\n app_id = default_app_id(ROOT)\n else:\n app_id = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L97_C4", "label": "app_id = default_app_id()", "type": "assigned_variable", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2", "vector": [14, 2, 0.8151, 0.0084, 2, 0.22, 0.0, 881, 3, 1, 0, 0, 478, 10, 1], "semantic": {"name": "app_id", "arg_names": [], "import_names": [], "rhs_call_name": "default_app_id", "annotation": ""}, "snippet": " app_id = default_app_id(ROOT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L99_C4", "label": "app_id =", "type": "assigned_variable", "loc": [99, 99], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2", "vector": [14, 2, 0.8319, 0.0084, 2, 0.22, 1.0, 881, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "app_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " app_id = args[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L101_C2", "label": "host =", "type": "assigned_variable", "loc": [101, 101], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [14, 1, 0.8487, 0.0084, 1, 0.77, 0.4444, 867, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L102_C2", "label": "if", "type": "if", "loc": [102, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [4, 1, 0.8613, 0.0168, 1, 0.77, 0.5556, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(args) > 1:\n host = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L103_C4", "label": "host =", "type": "assigned_variable", "loc": [103, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L102_C2", "vector": [14, 2, 0.8655, 0.0084, 2, 0.79, 0.0, 867, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "host", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " host = args[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2", "label": "if", "type": "if", "loc": [105, 108], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [4, 1, 0.895, 0.0336, 1, 0.77, 0.6667, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if options.verbose:\n logging.basicConfig(level=logging.DEBUG)\n else:\n logging.basicConfig(level=logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L106_C4", "label": "basicConfig()", "type": "expression", "loc": [106, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2", "vector": [8, 2, 0.8908, 0.0084, 2, 0.48, 0.0, 256, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "basicConfig", "arg_names": [], "import_names": [], "rhs_call_name": "basicConfig", "annotation": ""}, "snippet": " logging.basicConfig(level=logging.DEBUG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L108_C4", "label": "basicConfig()", "type": "expression", "loc": [108, 108], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2", "vector": [8, 2, 0.9076, 0.0084, 2, 0.48, 1.0, 256, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "basicConfig", "arg_names": [], "import_names": [], "rhs_call_name": "basicConfig", "annotation": ""}, "snippet": " logging.basicConfig(level=logging.ERROR)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L110_C2", "label": "predefined_vars = setup_env()", "type": "assigned_variable", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [14, 1, 0.9244, 0.0084, 1, 0.77, 0.7778, 658, 3, 2, 0, 0, 193, 10, 1], "semantic": {"name": "predefined_vars", "arg_names": [], "import_names": [], "rhs_call_name": "setup_env", "annotation": ""}, "snippet": " predefined_vars = setup_env(app_id, host)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L111_C2", "label": "prompt =", "type": "assigned_variable", "loc": [111, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [14, 1, 0.9454, 0.0336, 1, 0.77, 0.8889, 628, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "prompt", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prompt = (\n 'App Engine interactive console for \"%s\".\\n'\n 'Available symbols:\\n'\n ' %s\\n') % (app_id, ', '.join(sorted(predefined_vars)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L115_C2", "label": "interact()", "type": "expression", "loc": [115, 115], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "vector": [8, 1, 0.9664, 0.0084, 1, 0.77, 1.0, 629, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "interact", "arg_names": [], "import_names": [], "rhs_call_name": "interact", "annotation": ""}, "snippet": " code.interact(prompt, None, predefined_vars)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L118_C0", "label": "if", "type": "if", "loc": [118, 119], "level": 0, "parent": null, "vector": [4, 0, 0.9958, 0.0168, 0, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "if __name__ == '__main__':\n sys.exit(main())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L119_C2", "label": "exit()", "type": "expression", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L118_C0", "vector": [8, 1, 1.0, 0.0084, 1, 0.03, 0.0, 436, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(main())"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L38_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:Try_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L55_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Import_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:ImportFrom_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:For_L85_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:For_L85_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L86_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L86_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L87_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Return_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L101_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L102_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L106_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L105_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L110_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Assign_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:FunctionDef_L91_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1177:If_L118_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1177:Expr_L119_C2"}] |
# Copyright 2008-2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Top-level URL mappings for Rietveld."""
# NOTE: Must import *, since Django looks for things here, e.g. handler500.
from django.conf.urls.defaults import *
# If you don't want to run Rietveld from the root level, add the
# subdirectory as shown in the following example:
#
# url(r'subpath/', include('codereview.urls')),
#
urlpatterns = patterns(
'',
url(r'', include('codereview.urls')),
)
| ajibawa-2023/Python-Code-Large/train/row_1179 | 3 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1179:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.5357, 0.0357, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Top-level URL mappings for Rietveld.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1179:ImportFrom_L18_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.6429, 0.0357, 0, 0.66, 0.5, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1179:Assign_L25_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [25, 28], "level": 0, "parent": null, "vector": [14, 0, 0.9464, 0.1429, 0, 0.66, 1.0, 990, 3, 2, 0, 0, 75, 10, 3], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns(\n '',\n url(r'', include('codereview.urls')),\n )"}] | [] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Minimal Django settings."""
import os
from google.appengine.api import app_identity
# Banner for e.g. planned downtime announcements
## SPECIAL_BANNER = """\
## Rietveld will be down for maintenance on
## Thursday November 17
## from
## <a href="http://www.timeanddate.com/worldclock/fixedtime.html?iso=20111117T17&ah=6">
## 17:00 - 23:00 UTC
## </a>
## """
APPEND_SLASH = False
DEBUG = os.environ['SERVER_SOFTWARE'].startswith('Dev')
INSTALLED_APPS = (
'codereview',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'codereview.middleware.AddUserToRequestMiddleware',
'codereview.middleware.PropagateExceptionMiddleware',
)
ROOT_URLCONF = 'urls'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
)
TEMPLATE_DEBUG = DEBUG
TEMPLATE_DIRS = (
os.path.join(os.path.dirname(__file__), 'templates'),
)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source',
)
FILE_UPLOAD_HANDLERS = (
'django.core.files.uploadhandler.MemoryFileUploadHandler',
)
FILE_UPLOAD_MAX_MEMORY_SIZE = 1048576 # 1 MB
MEDIA_URL = '/static/'
appid = app_identity.get_application_id()
RIETVELD_INCOMING_MAIL_ADDRESS = ('reply@%s.appspotmail.com' % appid)
RIETVELD_INCOMING_MAIL_MAX_SIZE = 500 * 1024 # 500K
RIETVELD_REVISION = '<unknown>'
try:
RIETVELD_REVISION = open(
os.path.join(os.path.dirname(__file__), 'REVISION')
).read()
except:
pass
UPLOAD_PY_SOURCE = os.path.join(os.path.dirname(__file__), 'upload.py')
# Default values for patch rendering
DEFAULT_CONTEXT = 10
DEFAULT_COLUMN_WIDTH = 80
MIN_COLUMN_WIDTH = 3
MAX_COLUMN_WIDTH = 2000
| ajibawa-2023/Python-Code-Large/train/row_1180 | 26 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.1948, 0.013, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Minimal Django settings.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Import_L17_C0", "label": "os import os", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2208, 0.013, 0, 0.66, 0.0417, 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_1180:ImportFrom_L19_C0", "label": "from google.appengine.api import app_identity", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2468, 0.013, 0, 0.66, 0.0833, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["app_identity"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import app_identity"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L31_C0", "label": "APPEND_SLASH =", "type": "assigned_variable", "loc": [31, 31], "level": 0, "parent": null, "vector": [14, 0, 0.4026, 0.013, 0, 0.66, 0.125, 634, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "APPEND_SLASH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "APPEND_SLASH = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L32_C0", "label": "DEBUG = startswith()", "type": "assigned_variable", "loc": [32, 32], "level": 0, "parent": null, "vector": [14, 0, 0.4156, 0.013, 0, 0.66, 0.1667, 309, 3, 1, 0, 0, 193, 10, 1], "semantic": {"name": "DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "startswith", "annotation": ""}, "snippet": "DEBUG = os.environ['SERVER_SOFTWARE'].startswith('Dev')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L33_C0", "label": "INSTALLED_APPS =", "type": "assigned_variable", "loc": [33, 35], "level": 0, "parent": null, "vector": [14, 0, 0.4416, 0.039, 0, 0.66, 0.2083, 648, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "INSTALLED_APPS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "INSTALLED_APPS = (\n 'codereview',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L36_C0", "label": "MIDDLEWARE_CLASSES =", "type": "assigned_variable", "loc": [36, 41], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.0779, 0, 0.66, 0.25, 641, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "MIDDLEWARE_CLASSES", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIDDLEWARE_CLASSES = (\n 'django.middleware.common.CommonMiddleware',\n 'django.middleware.http.ConditionalGetMiddleware',\n 'codereview.middleware.AddUserToRequestMiddleware',\n 'codereview.middleware.PropagateExceptionMiddleware',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L42_C0", "label": "ROOT_URLCONF =", "type": "assigned_variable", "loc": [42, 42], "level": 0, "parent": null, "vector": [14, 0, 0.5455, 0.013, 0, 0.66, 0.2917, 281, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "ROOT_URLCONF", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "ROOT_URLCONF = 'urls'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L43_C0", "label": "TEMPLATE_CONTEXT_PROCESSORS =", "type": "assigned_variable", "loc": [43, 45], "level": 0, "parent": null, "vector": [14, 0, 0.5714, 0.039, 0, 0.66, 0.3333, 470, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "TEMPLATE_CONTEXT_PROCESSORS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_CONTEXT_PROCESSORS = (\n 'django.core.context_processors.request',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L46_C0", "label": "TEMPLATE_DEBUG =", "type": "assigned_variable", "loc": [46, 46], "level": 0, "parent": null, "vector": [14, 0, 0.5974, 0.013, 0, 0.66, 0.375, 7, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "TEMPLATE_DEBUG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DEBUG = DEBUG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L47_C0", "label": "TEMPLATE_DIRS =", "type": "assigned_variable", "loc": [47, 49], "level": 0, "parent": null, "vector": [14, 0, 0.6234, 0.039, 0, 0.66, 0.4167, 910, 0, 0, 0, 0, 0, 8, 2], "semantic": {"name": "TEMPLATE_DIRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_DIRS = (\n os.path.join(os.path.dirname(__file__), 'templates'),\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L50_C0", "label": "TEMPLATE_LOADERS =", "type": "assigned_variable", "loc": [50, 52], "level": 0, "parent": null, "vector": [14, 0, 0.6623, 0.039, 0, 0.66, 0.4583, 473, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "TEMPLATE_LOADERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TEMPLATE_LOADERS = (\n 'django.template.loaders.filesystem.load_template_source',\n )"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L53_C0", "label": "FILE_UPLOAD_HANDLERS =", "type": "assigned_variable", "loc": [53, 55], "level": 0, "parent": null, "vector": [14, 0, 0.7013, 0.039, 0, 0.66, 0.5, 216, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "FILE_UPLOAD_HANDLERS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FILE_UPLOAD_HANDLERS = (\n 'django.core.files.uploadhandler.MemoryFileUploadHandler',\n)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L56_C0", "label": "FILE_UPLOAD_MAX_MEMORY_SIZE =", "type": "assigned_variable", "loc": [56, 56], "level": 0, "parent": null, "vector": [14, 0, 0.7273, 0.013, 0, 0.66, 0.5417, 432, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "FILE_UPLOAD_MAX_MEMORY_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "FILE_UPLOAD_MAX_MEMORY_SIZE = 1048576 # 1 MB"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L58_C0", "label": "MEDIA_URL =", "type": "assigned_variable", "loc": [58, 58], "level": 0, "parent": null, "vector": [14, 0, 0.7532, 0.013, 0, 0.66, 0.5833, 120, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "MEDIA_URL", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MEDIA_URL = '/static/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L60_C0", "label": "appid = get_application_id()", "type": "assigned_variable", "loc": [60, 60], "level": 0, "parent": null, "vector": [14, 0, 0.7792, 0.013, 0, 0.66, 0.625, 944, 3, 0, 0, 0, 775, 10, 1], "semantic": {"name": "appid", "arg_names": [], "import_names": [], "rhs_call_name": "get_application_id", "annotation": ""}, "snippet": "appid = app_identity.get_application_id()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L61_C0", "label": "RIETVELD_INCOMING_MAIL_ADDRESS =", "type": "assigned_variable", "loc": [61, 61], "level": 0, "parent": null, "vector": [14, 0, 0.7922, 0.013, 0, 0.66, 0.6667, 849, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "RIETVELD_INCOMING_MAIL_ADDRESS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RIETVELD_INCOMING_MAIL_ADDRESS = ('reply@%s.appspotmail.com' % appid)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L62_C0", "label": "RIETVELD_INCOMING_MAIL_MAX_SIZE =", "type": "assigned_variable", "loc": [62, 62], "level": 0, "parent": null, "vector": [14, 0, 0.8052, 0.013, 0, 0.66, 0.7083, 22, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "RIETVELD_INCOMING_MAIL_MAX_SIZE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RIETVELD_INCOMING_MAIL_MAX_SIZE = 500 * 1024 # 500K"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L63_C0", "label": "RIETVELD_REVISION =", "type": "assigned_variable", "loc": [63, 63], "level": 0, "parent": null, "vector": [14, 0, 0.8182, 0.013, 0, 0.66, 0.75, 104, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "RIETVELD_REVISION", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RIETVELD_REVISION = '<unknown>'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Try_L64_C0", "label": "try", "type": "try", "loc": [64, 69], "level": 0, "parent": null, "vector": [7, 0, 0.8636, 0.0779, 0, 0.66, 0.7917, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "try:\n RIETVELD_REVISION = open(\n os.path.join(os.path.dirname(__file__), 'REVISION')\n ).read()\nexcept:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L65_C4", "label": "RIETVELD_REVISION = read()", "type": "assigned_variable", "loc": [65, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1180:Try_L64_C0", "vector": [14, 1, 0.8571, 0.039, 1, 0.28, 0.0, 104, 3, 0, 0, 0, 453, 10, 4], "semantic": {"name": "RIETVELD_REVISION", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " RIETVELD_REVISION = open(\n os.path.join(os.path.dirname(__file__), 'REVISION')\n ).read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L71_C0", "label": "UPLOAD_PY_SOURCE = join()", "type": "assigned_variable", "loc": [71, 71], "level": 0, "parent": null, "vector": [14, 0, 0.9221, 0.013, 0, 0.66, 0.8333, 707, 3, 2, 0, 0, 933, 10, 2], "semantic": {"name": "UPLOAD_PY_SOURCE", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": "UPLOAD_PY_SOURCE = os.path.join(os.path.dirname(__file__), 'upload.py')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L74_C0", "label": "DEFAULT_CONTEXT =", "type": "assigned_variable", "loc": [74, 74], "level": 0, "parent": null, "vector": [14, 0, 0.961, 0.013, 0, 0.66, 0.875, 534, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEFAULT_CONTEXT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_CONTEXT = 10"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L75_C0", "label": "DEFAULT_COLUMN_WIDTH =", "type": "assigned_variable", "loc": [75, 75], "level": 0, "parent": null, "vector": [14, 0, 0.974, 0.013, 0, 0.66, 0.9167, 959, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "DEFAULT_COLUMN_WIDTH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "DEFAULT_COLUMN_WIDTH = 80"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L76_C0", "label": "MIN_COLUMN_WIDTH =", "type": "assigned_variable", "loc": [76, 76], "level": 0, "parent": null, "vector": [14, 0, 0.987, 0.013, 0, 0.66, 0.9583, 640, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MIN_COLUMN_WIDTH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MIN_COLUMN_WIDTH = 3"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L77_C0", "label": "MAX_COLUMN_WIDTH =", "type": "assigned_variable", "loc": [77, 77], "level": 0, "parent": null, "vector": [14, 0, 1.0, 0.013, 0, 0.66, 1.0, 592, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MAX_COLUMN_WIDTH", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MAX_COLUMN_WIDTH = 2000"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1180:Try_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1180:Assign_L65_C4"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import md5
from django.contrib.syndication.feeds import Feed
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.utils.feedgenerator import Atom1Feed
from codereview import library
from codereview import models
class BaseFeed(Feed):
title = 'Code Review'
description = 'Rietveld: Code Review Tool hosted on Google App Engine'
feed_type = Atom1Feed
def link(self):
return reverse('codereview.views.index')
def author_name(self):
return 'rietveld'
def item_guid(self, item):
return 'urn:md5:%s' % (md5.new(str(item.key())).hexdigest())
def item_link(self, item):
if isinstance(item, models.PatchSet):
if item.data is not None:
return reverse('codereview.views.download',
args=[item.issue.key().id(),item.key().id()])
else:
# Patch set is too large, only the splitted diffs are available.
return reverse('codereview.views.show', args=[item.parent_key().id()])
if isinstance(item, models.Message):
return '%s#msg-%s' % (reverse('codereview.views.show',
args=[item.issue.key().id()]),
item.key())
return reverse('codereview.views.show', args=[item.key().id()])
def item_title(self, item):
return 'the title'
def item_author_name(self, item):
if isinstance(item, models.Issue):
return library.get_nickname(item.owner, True)
if isinstance(item, models.PatchSet):
return library.get_nickname(item.issue.owner, True)
if isinstance(item, models.Message):
return library.get_nickname(item.sender, True)
return 'Rietveld'
def item_pubdate(self, item):
if isinstance(item, models.Issue):
return item.modified
if isinstance(item, models.PatchSet):
# Use created, not modified, so that commenting on
# a patch set does not bump its place in the RSS feed.
return item.created
if isinstance(item, models.Message):
return item.date
return None
class BaseUserFeed(BaseFeed):
def get_object(self, bits):
"""Returns the account for the requested user feed.
bits is a list of URL path elements. The first element of this list
should be the user's nickname. A 404 is raised if the list is empty or
has more than one element or if the a user with that nickname
doesn't exist.
"""
if len(bits) != 1:
raise ObjectDoesNotExist
obj = bits[0]
account = models.Account.get_account_for_nickname('%s' % obj)
if account is None:
raise ObjectDoesNotExist
return account
class ReviewsFeed(BaseUserFeed):
title = 'Code Review - All issues I have to review'
def items(self, obj):
return _rss_helper(obj.email, 'closed = FALSE AND reviewers = :1',
use_email=True)
class ClosedFeed(BaseUserFeed):
title = "Code Review - Reviews closed by me"
def items(self, obj):
return _rss_helper(obj.email, 'closed = TRUE AND owner = :1')
class MineFeed(BaseUserFeed):
title = 'Code Review - My issues'
def items(self, obj):
return _rss_helper(obj.email, 'closed = FALSE AND owner = :1')
class AllFeed(BaseFeed):
title = 'Code Review - All issues'
def items(self):
query = models.Issue.gql('WHERE closed = FALSE AND private = FALSE '
'ORDER BY modified DESC')
return query.fetch(RSS_LIMIT)
class OneIssueFeed(BaseFeed):
def link(self):
return reverse('codereview.views.index')
def get_object(self, bits):
if len(bits) != 1:
raise ObjectDoesNotExist
obj = models.Issue.get_by_id(int(bits[0]))
if obj:
return obj
raise ObjectDoesNotExist
def title(self, obj):
return 'Code review - Issue %d: %s' % (obj.key().id(), obj.subject)
def items(self, obj):
all = list(obj.patchset_set) + list(obj.message_set)
all.sort(key=self.item_pubdate)
return all
### RSS feeds ###
# Maximum number of issues reported by RSS feeds
RSS_LIMIT = 20
def _rss_helper(email, query_string, use_email=False):
account = models.Account.get_account_for_email(email)
if account is None:
issues = []
else:
query = models.Issue.gql('WHERE %s AND private = FALSE '
'ORDER BY modified DESC' % query_string,
use_email and account.email or account.user)
issues = query.fetch(RSS_LIMIT)
return issues
| ajibawa-2023/Python-Code-Large/train/row_1182 | 90 | 163 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Import_L15_C0", "label": "md5 import md5", "type": "import", "loc": [15, 15], "level": 0, "parent": null, "vector": [1, 0, 0.092, 0.0061, 0, 0.66, 0.0, 604, 0, 1, 0, 0, 604, 0, 0], "semantic": {"name": "md5", "arg_names": [], "import_names": ["md5"], "rhs_call_name": "", "annotation": ""}, "snippet": "import md5"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L17_C0", "label": "from django.contrib.syndication.feeds import Feed", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1043, 0.0061, 0, 0.66, 0.0667, 211, 0, 1, 0, 0, 211, 0, 0], "semantic": {"name": "django.contrib.syndication.feeds", "arg_names": [], "import_names": ["Feed"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.contrib.syndication.feeds import Feed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L18_C0", "label": "from django.core.exceptions import ObjectDoesNotExist", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1104, 0.0061, 0, 0.66, 0.1333, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.core.exceptions", "arg_names": [], "import_names": ["ObjectDoesNotExist"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.exceptions import ObjectDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L19_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1166, 0.0061, 0, 0.66, 0.2, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L20_C0", "label": "from django.utils.feedgenerator import Atom1Feed", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.1227, 0.0061, 0, 0.66, 0.2667, 366, 0, 1, 0, 0, 366, 0, 0], "semantic": {"name": "django.utils.feedgenerator", "arg_names": [], "import_names": ["Atom1Feed"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.utils.feedgenerator import Atom1Feed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L22_C0", "label": "from codereview import library", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.135, 0.0061, 0, 0.66, 0.3333, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["library"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import library"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ImportFrom_L23_C0", "label": "from codereview import models", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.1411, 0.0061, 0, 0.66, 0.4, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "label": "BaseFeed", "type": "class", "loc": [26, 75], "level": 0, "parent": null, "vector": [3, 0, 0.3098, 0.3067, 0, 0.66, 0.4667, 346, 0, 7, 0, 0, 571, 0, 31], "semantic": {"name": "BaseFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseFeed(Feed):\n title = 'Code Review'\n description = 'Rietveld: Code Review Tool hosted on Google App Engine'\n feed_type = Atom1Feed\n\n def link(self):\n return reverse('codereview.views.index')\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L27_C2", "label": "title =", "type": "assigned_variable", "loc": [27, 27], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [14, 1, 0.1656, 0.0061, 1, 0.62, 0.0, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = 'Code Review'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L28_C2", "label": "description =", "type": "assigned_variable", "loc": [28, 28], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [14, 1, 0.1718, 0.0061, 1, 0.62, 0.1111, 306, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "description", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " description = 'Rietveld: Code Review Tool hosted on Google App Engine'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L29_C2", "label": "feed_type =", "type": "assigned_variable", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [14, 1, 0.1779, 0.0061, 1, 0.62, 0.2222, 55, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "feed_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " feed_type = Atom1Feed"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L31_C2", "label": "link", "type": "function", "loc": [31, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.1933, 0.0123, 1, 0.62, 0.3333, 880, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "link", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def link(self):\n return reverse('codereview.views.index')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L32_C4", "label": "return", "type": "return", "loc": [32, 32], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L31_C2", "vector": [13, 2, 0.1963, 0.0061, 2, 0.11, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse('codereview.views.index')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L34_C2", "label": "author_name", "type": "function", "loc": [34, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.2117, 0.0123, 1, 0.62, 0.4444, 920, 0, 1, 1, 0, 0, 0, 0], "semantic": {"name": "author_name", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def author_name(self):\n return 'rietveld'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L35_C4", "label": "return", "type": "return", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L34_C2", "vector": [13, 2, 0.2147, 0.0061, 2, 0.95, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'rietveld'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L37_C2", "label": "item_guid", "type": "function", "loc": [37, 38], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.2301, 0.0123, 1, 0.62, 0.5556, 386, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "item_guid", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def item_guid(self, item):\n return 'urn:md5:%s' % (md5.new(str(item.key())).hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L38_C4", "label": "return", "type": "return", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L37_C2", "vector": [13, 2, 0.2331, 0.0061, 2, 0.41, 0.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'urn:md5:%s' % (md5.new(str(item.key())).hexdigest())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "label": "item_link", "type": "function", "loc": [40, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.2822, 0.0798, 1, 0.62, 0.6667, 709, 0, 2, 1, 0, 0, 0, 17], "semantic": {"name": "item_link", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def item_link(self, item):\n if isinstance(item, models.PatchSet):\n if item.data is not None:\n return reverse('codereview.views.download',\n args=[item.issue.key().id(),item.key().id()])\n else:\n # Patch set is too large, only the splitted diffs are available.\n return reverse('codereview.views.show', args=[item.parent_key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L41_C4", "label": "if", "type": "if", "loc": [41, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "vector": [4, 2, 0.2699, 0.0429, 2, 0.46, 0.0, 0, 3, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.PatchSet):\n if item.data is not None:\n return reverse('codereview.views.download',\n args=[item.issue.key().id(),item.key().id()])\n else:\n # Patch set is too large, only the splitted diffs are available.\n return reverse('codereview.views.show', args=[item.parent_key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6", "label": "if", "type": "if", "loc": [42, 47], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L41_C4", "vector": [4, 3, 0.273, 0.0368, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if item.data is not None:\n return reverse('codereview.views.download',\n args=[item.issue.key().id(),item.key().id()])\n else:\n # Patch set is too large, only the splitted diffs are available.\n return reverse('codereview.views.show', args=[item.parent_key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L43_C8", "label": "return", "type": "return", "loc": [43, 44], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6", "vector": [13, 4, 0.2669, 0.0123, 4, 0.55, 0.0, 0, 3, 0, 0, 0, 0, 10, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse('codereview.views.download',\n args=[item.issue.key().id(),item.key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L47_C8", "label": "return", "type": "return", "loc": [47, 47], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6", "vector": [13, 4, 0.2883, 0.0061, 4, 0.55, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse('codereview.views.show', args=[item.parent_key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L48_C4", "label": "if", "type": "if", "loc": [48, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "vector": [4, 2, 0.3037, 0.0245, 2, 0.46, 0.5, 0, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.Message):\n return '%s#msg-%s' % (reverse('codereview.views.show',\n args=[item.issue.key().id()]),\n item.key())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L49_C6", "label": "return", "type": "return", "loc": [49, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L48_C4", "vector": [13, 3, 0.3067, 0.0184, 3, 0.26, 0.0, 0, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '%s#msg-%s' % (reverse('codereview.views.show',\n args=[item.issue.key().id()]),\n item.key())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "vector": [13, 2, 0.319, 0.0061, 2, 0.46, 1.0, 0, 3, 0, 0, 0, 0, 10, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse('codereview.views.show', args=[item.key().id()])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L54_C2", "label": "item_title", "type": "function", "loc": [54, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.3344, 0.0123, 1, 0.62, 0.7778, 142, 0, 2, 1, 0, 0, 0, 0], "semantic": {"name": "item_title", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def item_title(self, item):\n return 'the title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L55_C4", "label": "return", "type": "return", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L54_C2", "vector": [13, 2, 0.3374, 0.0061, 2, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'the title'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "label": "item_author_name", "type": "function", "loc": [57, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.3712, 0.0491, 1, 0.62, 0.8889, 303, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "item_author_name", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def item_author_name(self, item):\n if isinstance(item, models.Issue):\n return library.get_nickname(item.owner, True)\n if isinstance(item, models.PatchSet):\n return library.get_nickname(item.issue.owner, True)\n if isinstance(item, models.Message):\n return library.get_nickname(item.sender, True)\n return 'Rietveld'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L58_C4", "label": "if", "type": "if", "loc": [58, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "vector": [4, 2, 0.3589, 0.0123, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.Issue):\n return library.get_nickname(item.owner, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L59_C6", "label": "return", "type": "return", "loc": [59, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L58_C4", "vector": [13, 3, 0.362, 0.0061, 3, 0.53, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return library.get_nickname(item.owner, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L60_C4", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "vector": [4, 2, 0.3712, 0.0123, 2, 0.89, 0.3333, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.PatchSet):\n return library.get_nickname(item.issue.owner, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L61_C6", "label": "return", "type": "return", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L60_C4", "vector": [13, 3, 0.3742, 0.0061, 3, 0.82, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return library.get_nickname(item.issue.owner, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L62_C4", "label": "if", "type": "if", "loc": [62, 63], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "vector": [4, 2, 0.3834, 0.0123, 2, 0.89, 0.6667, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.Message):\n return library.get_nickname(item.sender, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L63_C6", "label": "return", "type": "return", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L62_C4", "vector": [13, 3, 0.3865, 0.0061, 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 library.get_nickname(item.sender, True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L64_C4", "label": "return", "type": "return", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "vector": [13, 2, 0.3926, 0.0061, 2, 0.89, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Rietveld'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "label": "item_pubdate", "type": "function", "loc": [66, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "vector": [2, 1, 0.4325, 0.0613, 1, 0.62, 1.0, 229, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "item_pubdate", "arg_names": ["self", "item"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def item_pubdate(self, item):\n if isinstance(item, models.Issue):\n return item.modified\n if isinstance(item, models.PatchSet):\n # Use created, not modified, so that commenting on\n # a patch set does not bump its place in the RSS feed.\n return item.created\n if isinstance(item, models.Message):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L67_C4", "label": "if", "type": "if", "loc": [67, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "vector": [4, 2, 0.4141, 0.0123, 2, 0.48, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.Issue):\n return item.modified"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L68_C6", "label": "return", "type": "return", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L67_C4", "vector": [13, 3, 0.4172, 0.0061, 3, 0.1, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item.modified"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L69_C4", "label": "if", "type": "if", "loc": [69, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "vector": [4, 2, 0.4325, 0.0245, 2, 0.48, 0.3333, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.PatchSet):\n # Use created, not modified, so that commenting on\n # a patch set does not bump its place in the RSS feed.\n return item.created"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L72_C6", "label": "return", "type": "return", "loc": [72, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L69_C4", "vector": [13, 3, 0.4417, 0.0061, 3, 0.09, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item.created"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L73_C4", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "vector": [4, 2, 0.4509, 0.0123, 2, 0.48, 0.6667, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(item, models.Message):\n return item.date"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L74_C6", "label": "return", "type": "return", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L73_C4", "vector": [13, 3, 0.454, 0.0061, 3, 0.16, 0.0, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return item.date"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L75_C4", "label": "return", "type": "return", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "vector": [13, 2, 0.4601, 0.0061, 2, 0.48, 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_1182:ClassDef_L78_C0", "label": "BaseUserFeed", "type": "class", "loc": [78, 94], "level": 0, "parent": null, "vector": [3, 0, 0.5276, 0.1043, 0, 0.66, 0.5333, 303, 0, 1, 0, 0, 346, 0, 2], "semantic": {"name": "BaseUserFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class BaseUserFeed(BaseFeed):\n\n def get_object(self, bits):\n \"\"\"Returns the account for the requested user feed.\n\n bits is a list of URL path elements. The first element of this list\n should be the user's nickname. A 404 is raised if the list is empty or\n has more than one element or if the a user with that nickname"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "label": "get_object", "type": "function", "loc": [80, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L78_C0", "vector": [2, 1, 0.5337, 0.092, 1, 0.34, 0.0, 237, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "get_object", "arg_names": ["self", "bits"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_object(self, bits):\n \"\"\"Returns the account for the requested user feed.\n\n bits is a list of URL path elements. The first element of this list\n should be the user's nickname. A 404 is raised if the list is empty or\n has more than one element or if the a user with that nickname\n doesn't exist.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Expr_L81_C4", "label": "expression", "type": "expression", "loc": [81, 87], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [8, 2, 0.5153, 0.0429, 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 account for the requested user feed.\n\n bits is a list of URL path elements. The first element of this list\n should be the user's nickname. A 404 is raised if the list is empty or\n has more than one element or if the a user with that nickname\n doesn't exist.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L88_C4", "label": "if", "type": "if", "loc": [88, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [4, 2, 0.5429, 0.0123, 2, 0.76, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(bits) != 1:\n raise ObjectDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L90_C4", "label": "obj =", "type": "assigned_variable", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [14, 2, 0.5521, 0.0061, 2, 0.76, 0.4, 505, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obj = bits[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L91_C4", "label": "account = get_account_for_nickname()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [14, 2, 0.5583, 0.0061, 2, 0.76, 0.6, 492, 3, 1, 0, 0, 938, 10, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "get_account_for_nickname", "annotation": ""}, "snippet": " account = models.Account.get_account_for_nickname('%s' % obj)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [4, 2, 0.5675, 0.0123, 2, 0.76, 0.8, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if account is None:\n raise ObjectDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L94_C4", "label": "return", "type": "return", "loc": [94, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "vector": [13, 2, 0.5767, 0.0061, 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 account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L97_C0", "label": "ReviewsFeed", "type": "class", "loc": [97, 102], "level": 0, "parent": null, "vector": [3, 0, 0.6104, 0.0368, 0, 0.66, 0.6, 246, 0, 1, 0, 0, 303, 0, 1], "semantic": {"name": "ReviewsFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ReviewsFeed(BaseUserFeed):\n title = 'Code Review - All issues I have to review'\n\n def items(self, obj):\n return _rss_helper(obj.email, 'closed = FALSE AND reviewers = :1',\n use_email=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L98_C2", "label": "title =", "type": "assigned_variable", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L97_C0", "vector": [14, 1, 0.6012, 0.0061, 1, 0.94, 0.0, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = 'Code Review - All issues I have to review'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L100_C2", "label": "items", "type": "function", "loc": [100, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L97_C0", "vector": [2, 1, 0.6196, 0.0184, 1, 0.94, 1.0, 339, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, obj):\n return _rss_helper(obj.email, 'closed = FALSE AND reviewers = :1',\n use_email=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L101_C4", "label": "return", "type": "return", "loc": [101, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L100_C2", "vector": [13, 2, 0.6227, 0.0123, 2, 0.36, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _rss_helper(obj.email, 'closed = FALSE AND reviewers = :1',\n use_email=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L105_C0", "label": "ClosedFeed", "type": "class", "loc": [105, 109], "level": 0, "parent": null, "vector": [3, 0, 0.6564, 0.0307, 0, 0.66, 0.6667, 981, 0, 1, 0, 0, 303, 0, 1], "semantic": {"name": "ClosedFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class ClosedFeed(BaseUserFeed):\n title = \"Code Review - Reviews closed by me\"\n\n def items(self, obj):\n return _rss_helper(obj.email, 'closed = TRUE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L106_C2", "label": "title =", "type": "assigned_variable", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L105_C0", "vector": [14, 1, 0.6503, 0.0061, 1, 0.35, 0.0, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = \"Code Review - Reviews closed by me\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L108_C2", "label": "items", "type": "function", "loc": [108, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L105_C0", "vector": [2, 1, 0.6656, 0.0123, 1, 0.35, 1.0, 339, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, obj):\n return _rss_helper(obj.email, 'closed = TRUE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L109_C4", "label": "return", "type": "return", "loc": [109, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L108_C2", "vector": [13, 2, 0.6687, 0.0061, 2, 0.1, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _rss_helper(obj.email, 'closed = TRUE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L112_C0", "label": "MineFeed", "type": "class", "loc": [112, 116], "level": 0, "parent": null, "vector": [3, 0, 0.6994, 0.0307, 0, 0.66, 0.7333, 396, 0, 1, 0, 0, 303, 0, 1], "semantic": {"name": "MineFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class MineFeed(BaseUserFeed):\n title = 'Code Review - My issues'\n\n def items(self, obj):\n return _rss_helper(obj.email, 'closed = FALSE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L113_C2", "label": "title =", "type": "assigned_variable", "loc": [113, 113], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L112_C0", "vector": [14, 1, 0.6933, 0.0061, 1, 0.75, 0.0, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = 'Code Review - My issues'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L115_C2", "label": "items", "type": "function", "loc": [115, 116], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L112_C0", "vector": [2, 1, 0.7086, 0.0123, 1, 0.75, 1.0, 339, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "items", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, obj):\n return _rss_helper(obj.email, 'closed = FALSE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L116_C4", "label": "return", "type": "return", "loc": [116, 116], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L115_C2", "vector": [13, 2, 0.7117, 0.0061, 2, 0.16, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _rss_helper(obj.email, 'closed = FALSE AND owner = :1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L119_C0", "label": "AllFeed", "type": "class", "loc": [119, 125], "level": 0, "parent": null, "vector": [3, 0, 0.7485, 0.0429, 0, 0.66, 0.8, 189, 0, 1, 0, 0, 346, 0, 2], "semantic": {"name": "AllFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AllFeed(BaseFeed):\n title = 'Code Review - All issues'\n\n def items(self):\n query = models.Issue.gql('WHERE closed = FALSE AND private = FALSE '\n 'ORDER BY modified DESC')\n return query.fetch(RSS_LIMIT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L120_C2", "label": "title =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L119_C0", "vector": [14, 1, 0.7362, 0.0061, 1, 0.79, 0.0, 48, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "title", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " title = 'Code Review - All issues'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2", "label": "items", "type": "function", "loc": [122, 125], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L119_C0", "vector": [2, 1, 0.7577, 0.0245, 1, 0.79, 1.0, 339, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "items", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self):\n query = models.Issue.gql('WHERE closed = FALSE AND private = FALSE '\n 'ORDER BY modified DESC')\n return query.fetch(RSS_LIMIT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L123_C4", "label": "query = gql()", "type": "assigned_variable", "loc": [123, 124], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2", "vector": [14, 2, 0.7577, 0.0123, 2, 0.14, 0.0, 546, 3, 1, 0, 0, 883, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "gql", "annotation": ""}, "snippet": " query = models.Issue.gql('WHERE closed = FALSE AND private = FALSE '\n 'ORDER BY modified DESC')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L125_C4", "label": "return", "type": "return", "loc": [125, 125], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2", "vector": [13, 2, 0.7669, 0.0061, 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 query.fetch(RSS_LIMIT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "label": "OneIssueFeed", "type": "class", "loc": [128, 146], "level": 0, "parent": null, "vector": [3, 0, 0.8405, 0.1166, 0, 0.66, 0.8667, 746, 0, 4, 0, 0, 346, 0, 9], "semantic": {"name": "OneIssueFeed", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class OneIssueFeed(BaseFeed):\n def link(self):\n return reverse('codereview.views.index')\n\n def get_object(self, bits):\n if len(bits) != 1:\n raise ObjectDoesNotExist\n obj = models.Issue.get_by_id(int(bits[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L129_C2", "label": "link", "type": "function", "loc": [129, 130], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "vector": [2, 1, 0.7945, 0.0123, 1, 0.93, 0.0, 880, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "link", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def link(self):\n return reverse('codereview.views.index')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L130_C4", "label": "return", "type": "return", "loc": [130, 130], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L129_C2", "vector": [13, 2, 0.7975, 0.0061, 2, 0.65, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return reverse('codereview.views.index')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "label": "get_object", "type": "function", "loc": [132, 138], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "vector": [2, 1, 0.8282, 0.0429, 1, 0.93, 0.3333, 237, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "get_object", "arg_names": ["self", "bits"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def get_object(self, bits):\n if len(bits) != 1:\n raise ObjectDoesNotExist\n obj = models.Issue.get_by_id(int(bits[0]))\n if obj:\n return obj\n raise ObjectDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L133_C4", "label": "if", "type": "if", "loc": [133, 134], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "vector": [4, 2, 0.819, 0.0123, 2, 0.09, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(bits) != 1:\n raise ObjectDoesNotExist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L135_C4", "label": "obj = get_by_id()", "type": "assigned_variable", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "vector": [14, 2, 0.8282, 0.0061, 2, 0.09, 0.5, 505, 3, 1, 0, 0, 397, 10, 2], "semantic": {"name": "obj", "arg_names": [], "import_names": [], "rhs_call_name": "get_by_id", "annotation": ""}, "snippet": " obj = models.Issue.get_by_id(int(bits[0]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L136_C4", "label": "if", "type": "if", "loc": [136, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "vector": [4, 2, 0.8374, 0.0123, 2, 0.09, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if obj:\n return obj"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L137_C6", "label": "return", "type": "return", "loc": [137, 137], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L136_C4", "vector": [13, 3, 0.8405, 0.0061, 3, 0.11, 0.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_1182:FunctionDef_L140_C2", "label": "title", "type": "function", "loc": [140, 141], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "vector": [2, 1, 0.862, 0.0123, 1, 0.93, 0.6667, 48, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "title", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def title(self, obj):\n return 'Code review - Issue %d: %s' % (obj.key().id(), obj.subject)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L141_C4", "label": "return", "type": "return", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L140_C2", "vector": [13, 2, 0.865, 0.0061, 2, 0.74, 0.0, 0, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'Code review - Issue %d: %s' % (obj.key().id(), obj.subject)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "label": "items", "type": "function", "loc": [143, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "vector": [2, 1, 0.8865, 0.0245, 1, 0.93, 1.0, 339, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "items", "arg_names": ["self", "obj"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def items(self, obj):\n all = list(obj.patchset_set) + list(obj.message_set)\n all.sort(key=self.item_pubdate)\n return all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L144_C4", "label": "all =", "type": "assigned_variable", "loc": [144, 144], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "vector": [14, 2, 0.8834, 0.0061, 2, 0.86, 0.0, 895, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "all", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " all = list(obj.patchset_set) + list(obj.message_set)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Expr_L145_C4", "label": "sort()", "type": "expression", "loc": [145, 145], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "vector": [8, 2, 0.8896, 0.0061, 2, 0.86, 0.5, 489, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " all.sort(key=self.item_pubdate)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L146_C4", "label": "return", "type": "return", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "vector": [13, 2, 0.8957, 0.0061, 2, 0.86, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return all"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L152_C0", "label": "RSS_LIMIT =", "type": "assigned_variable", "loc": [152, 152], "level": 0, "parent": null, "vector": [14, 0, 0.9325, 0.0061, 0, 0.66, 0.9333, 937, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "RSS_LIMIT", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "RSS_LIMIT = 20"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "label": "_rss_helper", "type": "function", "loc": [154, 163], "level": 0, "parent": null, "vector": [2, 0, 0.9724, 0.0613, 0, 0.66, 1.0, 369, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_rss_helper", "arg_names": ["email", "query_string", "use_email"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _rss_helper(email, query_string, use_email=False):\n account = models.Account.get_account_for_email(email)\n if account is None:\n issues = []\n else:\n query = models.Issue.gql('WHERE %s AND private = FALSE '\n 'ORDER BY modified DESC' % query_string,\n use_email and account.email or account.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L155_C2", "label": "account = get_account_for_email()", "type": "assigned_variable", "loc": [155, 155], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "vector": [14, 1, 0.9509, 0.0061, 1, 0.98, 0.0, 492, 3, 1, 0, 0, 35, 10, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "get_account_for_email", "annotation": ""}, "snippet": " account = models.Account.get_account_for_email(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "label": "if", "type": "if", "loc": [156, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "vector": [4, 1, 0.9755, 0.0429, 1, 0.98, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if account is None:\n issues = []\n else:\n query = models.Issue.gql('WHERE %s AND private = FALSE '\n 'ORDER BY modified DESC' % query_string,\n use_email and account.email or account.user)\n issues = query.fetch(RSS_LIMIT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L157_C4", "label": "issues =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "vector": [14, 2, 0.9632, 0.0061, 2, 0.04, 0.0, 52, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "issues", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " issues = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L159_C4", "label": "query = gql()", "type": "assigned_variable", "loc": [159, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "vector": [14, 2, 0.9816, 0.0184, 2, 0.04, 0.5, 546, 3, 2, 0, 0, 883, 10, 1], "semantic": {"name": "query", "arg_names": [], "import_names": [], "rhs_call_name": "gql", "annotation": ""}, "snippet": " query = models.Issue.gql('WHERE %s AND private = FALSE '\n 'ORDER BY modified DESC' % query_string,\n use_email and account.email or account.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L162_C4", "label": "issues = fetch()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "vector": [14, 2, 0.9939, 0.0061, 2, 0.04, 1.0, 52, 3, 1, 0, 0, 587, 10, 1], "semantic": {"name": "issues", "arg_names": [], "import_names": [], "rhs_call_name": "fetch", "annotation": ""}, "snippet": " issues = query.fetch(RSS_LIMIT)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L163_C2", "label": "return", "type": "return", "loc": [163, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "vector": [13, 1, 1.0, 0.0061, 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 issues"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L31_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L32_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L34_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L37_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L37_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L43_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L42_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L47_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L49_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L40_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L54_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L59_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L67_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L68_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L69_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L78_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Expr_L81_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L80_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L100_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L100_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L108_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L109_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L113_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L112_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L115_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L115_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L116_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L119_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L123_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L122_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L125_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L129_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L129_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L130_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L132_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L136_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L137_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L140_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L140_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:ClassDef_L128_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Expr_L145_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L143_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L155_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1182:FunctionDef_L154_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1182:Return_L163_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Intra-region diff utilities.
Intra-region diff highlights the blocks of code which have been changed or
deleted within a region. So instead of highlighting the whole region marked as
changed, the user can see what exactly was changed within that region.
Terminology:
'region' is a list of consecutive code lines.
'word' is the unit of intra-region diff. Its definition is arbitrary based on
what we think as to be a good unit of difference between two regions.
'block' is a small section of code within a region. It can span multiple
lines. There can be multiple non overlapping blocks within a region. A block
can potentially span the whole region.
The blocks have two representations. One is of the format (offset1, offset2,
size) which is returned by the SequenceMatcher to indicate a match of
length 'size' starting at offset1 in the first/old line and starting at offset2
in the second/new line. We convert this representation to a pair of tuples i.e.
(offset1, size) and (offset2, size) for rendering each side of the diff
separately. This latter representation is also more efficient for doing
compaction of adjacent blocks which reduces the size of the HTML markup. See
CompactBlocks for more details.
SequenceMatcher always returns one special matching block at the end with
contents (len(line1), len(line2), 0). We retain this special block as it
simplifies for loops in rendering the last non-matching block. All functions
which deal with the sequence of blocks assume presence of the special block at
the end of the sequence and retain it.
"""
import cgi
import difflib
import re
# Tag to begin a diff chunk.
BEGIN_TAG = "<span class=\"%s\">"
# Tag to end a diff block.
END_TAG = "</span>"
# Tag used for visual tab indication.
TAB_TAG = "<span class=\"visualtab\">»</span>"
# Color scheme to govern the display properties of diff blocks and matching
# blocks. Each value e.g. 'oldlight' corresponds to a CSS style.
COLOR_SCHEME = {
'old': {
'match': 'oldlight',
'diff': 'olddark',
'bckgrnd': 'oldlight',
},
'new': {
'match': 'newlight',
'diff': 'newdark',
'bckgrnd': 'newlight',
},
'oldmove': {
'match': 'movelight',
'diff': 'oldmovedark',
'bckgrnd': 'movelight'
},
'newmove': {
'match': 'newlight',
'diff': 'newdark',
'bckgrnd': 'newlight'
},
}
# Regular expressions to tokenize lines. Default is 'd'.
EXPRS = {
'a': r'(\w+|[^\w\s]+|\s+)',
'b': r'([A-Za-z0-9]+|[^A-Za-z0-9])',
'c': r'([A-Za-z0-9_]+|[^A-Za-z0-9_])',
'd': r'([^\W_]+|[\W_])',
}
# Maximum total characters in old and new lines for doing intra-region diffs.
# Intra-region diff for larger regions is hard to comprehend and wastes CPU
# time.
MAX_TOTAL_LEN = 10000
def _ExpandTabs(text, column, tabsize, mark_tabs=False):
"""Expand tab characters in a string into spaces.
Args:
text: a string containing tab characters.
column: the initial column for the first character in text
tabsize: tab stops occur at columns that are multiples of tabsize
mark_tabs: if true, leave a tab character as the first character
of the expansion, so that the caller can find where
the tabs were.
Note that calling _ExpandTabs with mark_tabs=True is not idempotent.
"""
expanded = ""
while True:
tabpos = text.find("\t")
if tabpos < 0:
break
fillwidth = tabsize - (tabpos + column) % tabsize
column += tabpos + fillwidth
if mark_tabs:
fill = "\t" + " " * (fillwidth - 1)
else:
fill = " " * fillwidth
expanded += text[0:tabpos] + fill
text = text[tabpos+1:]
return expanded + text
def Break(text, offset=0, limit=80, brk="\n ", tabsize=8, mark_tabs=False):
"""Break text into lines.
Break text, which begins at column offset, each time it reaches
column limit.
To break the text, insert brk, which does not count toward
the column count of the next line and is assumed to be valid HTML.
During the text breaking process, replaces tabs with spaces up
to the next column that is a multiple of tabsize.
If mark_tabs is true, replace the first space of each expanded
tab with TAB_TAG.
Input and output are assumed to be in UTF-8; the computation is done
in Unicode. (Still not good enough if zero-width characters are
present.) If the input is not valid UTF-8, then the encoding is
passed through, potentially breaking up multi-byte characters.
We pass the line through cgi.escape before returning it.
A trailing newline is always stripped from the input first.
"""
assert tabsize > 0, tabsize
if text.endswith("\n"):
text = text[:-1]
try:
text = unicode(text, "utf-8")
except:
pass
# Expand all tabs.
# If mark_tabs is true, we retain one \t character as a marker during
# expansion so that we later replace it with an HTML snippet.
text = _ExpandTabs(text, offset, tabsize, mark_tabs)
# Perform wrapping.
if len(text) > limit - offset:
parts, text = [text[0:limit-offset]], text[limit-offset:]
while len(text) > limit:
parts.append(text[0:limit])
text = text[limit:]
parts.append(text)
text = brk.join([cgi.escape(p) for p in parts])
else:
text = cgi.escape(text)
# Colorize tab markers
text = text.replace("\t", TAB_TAG)
if isinstance(text, unicode):
return text.encode("utf-8", "replace")
return text
def CompactBlocks(blocks):
"""Compacts adjacent code blocks.
In many cases 2 adjacent blocks can be merged into one. This allows
to do some further processing on those blocks.
Args:
blocks: [(offset1, size), ...]
Returns:
A list with the same structure as the input with adjacent blocks
merged. However, the last block (which is always assumed to have
a zero size) is never merged. For example, the input
[(0, 2), (2, 8), (10, 5), (15, 0)]
will produce the output [(0, 15), (15, 0)].
"""
if len(blocks) == 1:
return blocks
result = [blocks[0]]
for block in blocks[1:-1]:
last_start, last_len = result[-1]
curr_start, curr_len = block
if last_start + last_len == curr_start:
result[-1] = last_start, last_len + curr_len
else:
result.append(block)
result.append(blocks[-1])
return result
def FilterBlocks(blocks, filter_func):
"""Gets rid of any blocks if filter_func evaluates false for them.
Args:
blocks: [(offset1, offset2, size), ...]; must have at least 1 entry
filter_func: a boolean function taking a single argument of the form
(offset1, offset2, size)
Returns:
A list with the same structure with entries for which filter_func()
returns false removed. However, the last block is always included.
"""
# We retain the 'special' block at the end.
res = [b for b in blocks[:-1] if filter_func(b)]
res.append(blocks[-1])
return res
def GetDiffParams(expr='d', min_match_ratio=0.6, min_match_size=2, dbg=False):
"""Returns a tuple of various parameters which affect intra region diffs.
Args:
expr: regular expression id to use to identify 'words' in the intra region
diff
min_match_ratio: minimum similarity between regions to qualify for intra
region diff
min_match_size: the smallest matching block size to use. Blocks smaller
than this are ignored.
dbg: to turn on generation of debugging information for the diff
Returns:
4 tuple (expr, min_match_ratio, min_match_size, dbg) that can be used to
customize diff. It can be passed to functions like WordDiff and
IntraLineDiff.
"""
assert expr in EXPRS
assert min_match_size in xrange(1, 5)
assert min_match_ratio > 0.0 and min_match_ratio < 1.0
return (expr, min_match_ratio, min_match_size, dbg)
def CanDoIRDiff(old_lines, new_lines):
"""Tells if it would be worth computing the intra region diff.
Calculating IR diff is costly and is usually helpful only for small regions.
We use a heuristic that if the total number of characters is more than a
certain threshold then we assume it is not worth computing the IR diff.
Args:
old_lines: an array of strings containing old text
new_lines: an array of strings containing new text
Returns:
True if we think it is worth computing IR diff for the region defined
by old_lines and new_lines, False otherwise.
TODO: Let GetDiffParams handle MAX_TOTAL_LEN param also.
"""
total_chars = (sum(len(line) for line in old_lines) +
sum(len(line) for line in new_lines))
return total_chars <= MAX_TOTAL_LEN
def WordDiff(line1, line2, diff_params):
"""Returns blocks with positions indiciating word level diffs.
Args:
line1: string representing the left part of the diff
line2: string representing the right part of the diff
diff_params: return value of GetDiffParams
Returns:
A tuple (blocks, ratio) where:
blocks: [(offset1, offset2, size), ...] such that
line1[offset1:offset1+size] == line2[offset2:offset2+size]
and the last block is always (len(line1), len(line2), 0)
ratio: a float giving the diff ratio computed by SequenceMatcher.
"""
match_expr, min_match_ratio, min_match_size, _ = diff_params
exp = EXPRS[match_expr]
# Strings may have been left undecoded up to now. Assume UTF-8.
try:
line1 = unicode(line1, "utf8")
except:
pass
try:
line2 = unicode(line2, "utf8")
except:
pass
a = re.findall(exp, line1, re.U)
b = re.findall(exp, line2, re.U)
s = difflib.SequenceMatcher(None, a, b)
matching_blocks = s.get_matching_blocks()
ratio = s.ratio()
# Don't show intra region diffs if both lines are too different and there is
# more than one block of difference. If there is only one change then we
# still show the intra region diff regardless of how different the blocks
# are.
# Note: We compare len(matching_blocks) with 3 because one block of change
# results in 2 matching blocks. We add the one special block and we get 3
# matching blocks per one block of change.
if ratio < min_match_ratio and len(matching_blocks) > 3:
return ([(0, 0, 0)], ratio)
# For now convert to character level blocks because we already have
# the code to deal with folding across lines for character blocks.
# Create arrays lena an lenb which have cumulative word lengths
# corresponding to word positions in a and b
lena = []
last = 0
for w in a:
lena.append(last)
last += len(w)
lenb = []
last = 0
for w in b:
lenb.append(last)
last += len(w)
lena.append(len(line1))
lenb.append(len(line2))
# Convert to character blocks
blocks = []
for s1, s2, blen in matching_blocks[:-1]:
apos = lena[s1]
bpos = lenb[s2]
block_len = lena[s1+blen] - apos
blocks.append((apos, bpos, block_len))
# Recreate the special block.
blocks.append((len(line1), len(line2), 0))
# Filter any matching blocks which are smaller than the desired threshold.
# We don't remove matching blocks with only a newline character as doing so
# results in showing the matching newline character as non matching which
# doesn't look good.
blocks = FilterBlocks(blocks, lambda b: (b[2] >= min_match_size or
line1[b[0]:b[0]+b[2]] == '\n'))
return (blocks, ratio)
def IntraLineDiff(line1, line2, diff_params, diff_func=WordDiff):
"""Computes intraline diff blocks.
Args:
line1: string representing the left part of the diff
line2: string representing the right part of the diff
diff_params: return value of GetDiffParams
diff_func: a function whose signature matches that of WordDiff() above
Returns:
A tuple of (blocks1, blocks2) corresponding to line1 and line2.
Each element of the tuple is an array of (start_pos, length)
tuples denoting a diff block.
"""
blocks, ratio = diff_func(line1, line2, diff_params)
blocks1 = [(start1, length) for (start1, start2, length) in blocks]
blocks2 = [(start2, length) for (start1, start2, length) in blocks]
return (blocks1, blocks2, ratio)
def DumpDiff(blocks, line1, line2):
"""Helper function to debug diff related problems.
Args:
blocks: [(offset1, offset2, size), ...]
line1: string representing the left part of the diff
line2: string representing the right part of the diff
"""
for offset1, offset2, size in blocks:
print offset1, offset2, size
print offset1, size, ": ", line1[offset1:offset1+size]
print offset2, size, ": ", line2[offset2:offset2+size]
def RenderIntraLineDiff(blocks, line, tag, dbg_info=None, limit=80, indent=5,
tabsize=8, mark_tabs=False):
"""Renders the diff blocks returned by IntraLineDiff function.
Args:
blocks: [(start_pos, size), ...]
line: line of code on which the blocks are to be rendered.
tag: 'new' or 'old' to control the color scheme.
dbg_info: a string that holds debugging informaion header. Debug
information is rendered only if dbg_info is not None.
limit: folding limit to be passed to the Break function.
indent: indentation size to be passed to the Break function.
tabsize: tab stops occur at columns that are multiples of tabsize
mark_tabs: if True, mark the first character of each expanded tab visually
Returns:
A tuple of two elements. First element is the rendered version of
the input 'line'. Second element tells if the line has a matching
newline character.
"""
res = ""
prev_start, prev_len = 0, 0
has_newline = False
debug_info = dbg_info
if dbg_info:
debug_info += "\nBlock Count: %d\nBlocks: " % (len(blocks) - 1)
for curr_start, curr_len in blocks:
if dbg_info and curr_len > 0:
debug_info += Break(
"\n(%d, %d):|%s|" %
(curr_start, curr_len, line[curr_start:curr_start+curr_len]),
limit, indent, tabsize, mark_tabs)
res += FoldBlock(line, prev_start + prev_len, curr_start, limit, indent,
tag, 'diff', tabsize, mark_tabs)
res += FoldBlock(line, curr_start, curr_start + curr_len, limit, indent,
tag, 'match', tabsize, mark_tabs)
# TODO: This test should be out of loop rather than inside. Once we
# filter out some junk from blocks (e.g. some empty blocks) we should do
# this test only on the last matching block.
if line[curr_start:curr_start+curr_len].endswith('\n'):
has_newline = True
prev_start, prev_len = curr_start, curr_len
return (res, has_newline, debug_info)
def FoldBlock(src, start, end, limit, indent, tag, btype, tabsize=8,
mark_tabs=False):
"""Folds and renders a block.
Args:
src: line of code
start: starting position of the block within 'src'.
end: ending position of the block within 'src'.
limit: folding limit
indent: indentation to use for folding.
tag: 'new' or 'old' to control the color scheme.
btype: block type i.e. 'match' or 'diff' to control the color schme.
tabsize: tab stops occur at columns that are multiples of tabsize
mark_tabs: if True, mark the first character of each expanded tab visually
Returns:
A string representing the rendered block.
"""
text = src[start:end]
# We ignore newlines because we do newline management ourselves.
# Any other new lines with at the end will be stripped off by the Break
# method.
if start >= end or text == '\n':
return ""
fbegin, lend, nl_plus_indent = GetTags(tag, btype, indent)
# 'bol' is beginning of line.
# The text we care about begins at byte offset start
# but if there are tabs it will have a larger column
# offset. Use len(_ExpandTabs()) to find out how many
# columns the starting prefix occupies.
offset_from_bol = len(_ExpandTabs(src[0:start], 0, tabsize)) % limit
brk = lend + nl_plus_indent + fbegin
text = Break(text, offset_from_bol, limit, brk, tabsize, mark_tabs)
if text:
text = fbegin + text + lend
# If this is the first block of the line and this is not the first line then
# insert newline + indent.
if offset_from_bol == 0 and not start == 0:
text = nl_plus_indent + text
return text
def GetTags(tag, btype, indent):
"""Returns various tags for rendering diff blocks.
Args:
tag: a key from COLOR_SCHEME
btype: 'match' or 'diff'
indent: indentation to use
Returns
A 3 tuple (begin_tag, end_tag, formatted_indent_block)
"""
assert tag in COLOR_SCHEME
assert btype in ['match', 'diff']
fbegin = BEGIN_TAG % COLOR_SCHEME[tag][btype]
bbegin = BEGIN_TAG % COLOR_SCHEME[tag]['bckgrnd']
lend = END_TAG
nl_plus_indent = '\n'
if indent > 0:
nl_plus_indent += bbegin + cgi.escape(" "*indent) + lend
return fbegin, lend, nl_plus_indent
def ConvertToSingleLine(lines):
"""Transforms a sequence of strings into a single line.
Returns the state that can be used to reconstruct the original lines with
the newline separators placed at the original place.
Args:
lines: sequence of strings
Returns:
Returns (single_line, state) tuple. 'state' shouldn't be modified by the
caller. It is only used to pass to other functions which will do certain
operations on this state.
'state' is an array containing a dictionary for each item in lines. Each
dictionary has two elements 'pos' and 'blocks'. 'pos' is the end position
of each line in the final converted string. 'blocks' is an array of blocks
for each line of code. These blocks are added using MarkBlock function.
"""
state = []
total_length = 0
for l in lines:
total_length += len(l)
# TODO: Use a tuple instead.
state.append({'pos': total_length, # the line split point
'blocks': [], # blocks which belong to this line
})
result = "".join(lines)
assert len(state) == len(lines)
return (result, state)
def MarkBlock(state, begin, end):
"""Marks a block on a region such that it doesn't cross line boundaries.
It is an operation that can be performed on the single line which was
returned by the ConvertToSingleLine function. This operation marks arbitrary
block [begin,end) on the text. It also ensures that if [begin,end) crosses
line boundaries in the original region then it splits the section up in 2 or
more blocks such that no block crosses the boundaries.
Args:
state: the state returned by ConvertToSingleLine function. The state
contained is modified by this function.
begin: Beginning of the block.
end: End of the block (exclusive).
Returns:
None.
"""
# TODO: Make sure already existing blocks don't overlap
if begin == end:
return
last_pos = 0
for entry in state:
pos = entry['pos']
if begin >= last_pos and begin < pos:
if end < pos:
# block doesn't cross any line boundary
entry['blocks'].append((begin, end))
else:
# block crosses the line boundary
entry['blocks'].append((begin, pos))
MarkBlock(state, pos, end)
break
last_pos = pos
def GetBlocks(state):
"""Returns all the blocks corresponding to the lines in the region.
Args:
state: the state returned by ConvertToSingleLine().
Returns:
An array of [(start_pos, length), ..] with an entry for each line in the
region.
"""
result = []
last_pos = 0
for entry in state:
pos = entry['pos']
# Calculate block start points from the beginning of individual lines.
blocks = [(s[0]-last_pos, s[1]-s[0]) for s in entry['blocks']]
# Add one end marker block.
blocks.append((pos-last_pos, 0))
result.append(blocks)
last_pos = pos
return result
def IntraRegionDiff(old_lines, new_lines, diff_params):
"""Computes intra region diff.
Args:
old_lines: array of strings
new_lines: array of strings
diff_params: return value of GetDiffParams
Returns:
A tuple (old_blocks, new_blocks) containing matching blocks for old and new
lines.
"""
old_line, old_state = ConvertToSingleLine(old_lines)
new_line, new_state = ConvertToSingleLine(new_lines)
old_blocks, new_blocks, ratio = IntraLineDiff(old_line, new_line, diff_params)
for begin, length in old_blocks:
MarkBlock(old_state, begin, begin+length)
old_blocks = GetBlocks(old_state)
for begin, length in new_blocks:
MarkBlock(new_state, begin, begin+length)
new_blocks = GetBlocks(new_state)
return (old_blocks, new_blocks, ratio)
def NormalizeBlocks(blocks, line):
"""Normalizes block representation of an intra line diff.
One diff can have multiple representations. Some times the diff returned by
the difflib for similar text sections is different even within same region.
For example if 2 already indented lines were indented with one additional
space character, the difflib may return the non matching space character to
be any of the already existing spaces. So one line may show non matching
space character as the first space character and the second line may show it
to be the last space character. This is sometimes confusing. This is the
side effect of the new regular expression we are using in WordDiff for
identifying indvidual words. This regular expression ('b') treats a sequence
of punctuation and whitespace characters as individual characters. It has
some visual advantages for showing a character level punctuation change as
one character change rather than a group of character change.
Making the normalization too generic can have performance implications. So
this implementation of normalize blocks intends to handle only one case.
Let's say S represents the space character and () marks a matching block.
Then the normalize operation will do following:
SSSS(SS)(ABCD) => SSSS(SS)(ABCD)
(SS)SSSS(ABCD) => SSSS(SS)(ABCD)
(SSSS)SS(ABCD) => SS(SSSS)(ABCD)
and so on..
Args:
blocks: An array of (offset, len) tuples defined on 'line'. These blocks
mark the matching areas. Anything between these matching blocks is
considered non-matching.
line: The text string on which the blocks are defined.
Returns:
An array of (offset, len) tuples representing the same diff but in
normalized form.
"""
result = []
prev_start, prev_len = blocks[0]
for curr_start, curr_len in blocks[1:]:
# Note: nm_ is a prefix for non matching and m_ is a prefix for matching.
m_len, nm_len = prev_len, curr_start - (prev_start+prev_len)
# This if condition checks if matching and non matching parts are greater
# than zero length and are comprised of spaces ONLY. The last condition
# deals with most of the observed cases of strange diffs.
# Note: curr_start - prev_start == m_l + nm_l
# So line[prev_start:curr_start] == matching_part + non_matching_part.
text = line[prev_start:curr_start]
if m_len > 0 and nm_len > 0 and text == ' ' * len(text):
# Move the matching block towards the end i.e. normalize.
result.append((prev_start + nm_len, m_len))
else:
# Keep the existing matching block.
result.append((prev_start, prev_len))
prev_start, prev_len = curr_start, curr_len
result.append(blocks[-1])
assert len(result) == len(blocks)
return result
def RenderIntraRegionDiff(lines, diff_blocks, tag, ratio, limit=80, indent=5,
tabsize=8, mark_tabs=False, dbg=False):
"""Renders intra region diff for one side.
Args:
lines: list of strings representing source code in the region
diff_blocks: blocks that were returned for this region by IntraRegionDiff()
tag: 'new' or 'old'
ratio: similarity ratio returned by the diff computing function
limit: folding limit
indent: indentation size
tabsize: tab stops occur at columns that are multiples of tabsize
mark_tabs: if True, mark the first character of each expanded tab visually
dbg: indicates if debug information should be rendered
Returns:
A list of strings representing the rendered version of each item in input
'lines'.
"""
result = []
dbg_info = None
if dbg:
dbg_info = 'Ratio: %.1f' % ratio
for line, blocks in zip(lines, diff_blocks):
blocks = NormalizeBlocks(blocks, line)
blocks = CompactBlocks(blocks)
diff = RenderIntraLineDiff(blocks,
line,
tag,
dbg_info=dbg_info,
limit=limit,
indent=indent,
tabsize=tabsize,
mark_tabs=mark_tabs)
result.append(diff)
assert len(result) == len(lines)
return result
| ajibawa-2023/Python-Code-Large/train/row_1183 | 216 | 696 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 43], "level": 0, "parent": null, "vector": [8, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Intra-region diff utilities.\n\nIntra-region diff highlights the blocks of code which have been changed or\ndeleted within a region. So instead of highlighting the whole region marked as\nchanged, the user can see what exactly was changed within that region.\n\nTerminology:\n 'region' is a list of consecutive code lines."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Import_L45_C0", "label": "cgi import cgi", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.0647, 0.0014, 0, 0.66, 0.037, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Import_L46_C0", "label": "difflib import difflib", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.0661, 0.0014, 0, 0.66, 0.0741, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "difflib", "arg_names": [], "import_names": ["difflib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import difflib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Import_L47_C0", "label": "re import re", "type": "import", "loc": [47, 47], "level": 0, "parent": null, "vector": [1, 0, 0.0675, 0.0014, 0, 0.66, 0.1111, 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_1183:Assign_L50_C0", "label": "BEGIN_TAG =", "type": "assigned_variable", "loc": [50, 50], "level": 0, "parent": null, "vector": [14, 0, 0.0718, 0.0014, 0, 0.66, 0.1481, 437, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "BEGIN_TAG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "BEGIN_TAG = \"<span class=\\\"%s\\\">\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L52_C0", "label": "END_TAG =", "type": "assigned_variable", "loc": [52, 52], "level": 0, "parent": null, "vector": [14, 0, 0.0747, 0.0014, 0, 0.66, 0.1852, 89, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "END_TAG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "END_TAG = \"</span>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L54_C0", "label": "TAB_TAG =", "type": "assigned_variable", "loc": [54, 54], "level": 0, "parent": null, "vector": [14, 0, 0.0776, 0.0014, 0, 0.66, 0.2222, 282, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "TAB_TAG", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "TAB_TAG = \"<span class=\\\"visualtab\\\">»</span>\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L57_C0", "label": "COLOR_SCHEME =", "type": "assigned_variable", "loc": [57, 78], "level": 0, "parent": null, "vector": [14, 0, 0.097, 0.0316, 0, 0.66, 0.2593, 781, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "COLOR_SCHEME", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "COLOR_SCHEME = {\n 'old': {\n 'match': 'oldlight',\n 'diff': 'olddark',\n 'bckgrnd': 'oldlight',\n },\n 'new': {\n 'match': 'newlight',"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L80_C0", "label": "EXPRS =", "type": "assigned_variable", "loc": [80, 85], "level": 0, "parent": null, "vector": [14, 0, 0.1185, 0.0086, 0, 0.66, 0.2963, 219, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "EXPRS", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "EXPRS = {\n 'a': r'(\\w+|[^\\w\\s]+|\\s+)',\n 'b': r'([A-Za-z0-9]+|[^A-Za-z0-9])',\n 'c': r'([A-Za-z0-9_]+|[^A-Za-z0-9_])',\n 'd': r'([^\\W_]+|[\\W_])',\n }"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L89_C0", "label": "MAX_TOTAL_LEN =", "type": "assigned_variable", "loc": [89, 89], "level": 0, "parent": null, "vector": [14, 0, 0.1279, 0.0014, 0, 0.66, 0.3333, 915, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "MAX_TOTAL_LEN", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "MAX_TOTAL_LEN = 10000"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "label": "_ExpandTabs", "type": "function", "loc": [92, 118], "level": 0, "parent": null, "vector": [2, 0, 0.1509, 0.0388, 0, 0.66, 0.3704, 975, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "_ExpandTabs", "arg_names": ["text", "column", "tabsize", "mark_tabs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _ExpandTabs(text, column, tabsize, mark_tabs=False):\n \"\"\"Expand tab characters in a string into spaces.\n\n Args:\n text: a string containing tab characters.\n column: the initial column for the first character in text\n tabsize: tab stops occur at columns that are multiples of tabsize\n mark_tabs: if true, leave a tab character as the first character"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L93_C2", "label": "expression", "type": "expression", "loc": [93, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "vector": [8, 1, 0.1415, 0.0172, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Expand tab characters in a string into spaces.\n\n Args:\n text: a string containing tab characters.\n column: the initial column for the first character in text\n tabsize: tab stops occur at columns that are multiples of tabsize\n mark_tabs: if true, leave a tab character as the first character\n of the expansion, so that the caller can find where"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L105_C2", "label": "expanded =", "type": "assigned_variable", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "vector": [14, 1, 0.1509, 0.0014, 1, 0.94, 0.3333, 126, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "expanded", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expanded = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "label": "while", "type": "while", "loc": [106, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "vector": [5, 1, 0.1602, 0.0172, 1, 0.94, 0.6667, 0, 1, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while True:\n tabpos = text.find(\"\\t\")\n if tabpos < 0:\n break\n fillwidth = tabsize - (tabpos + column) % tabsize\n column += tabpos + fillwidth\n if mark_tabs:\n fill = \"\\t\" + \" \" * (fillwidth - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L107_C4", "label": "tabpos = find()", "type": "assigned_variable", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "vector": [14, 2, 0.1537, 0.0014, 2, 0.24, 0.0, 921, 3, 1, 0, 0, 340, 10, 1], "semantic": {"name": "tabpos", "arg_names": [], "import_names": [], "rhs_call_name": "find", "annotation": ""}, "snippet": " tabpos = text.find(\"\\t\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L108_C4", "label": "if", "type": "if", "loc": [108, 109], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "vector": [4, 2, 0.1559, 0.0029, 2, 0.24, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tabpos < 0:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L110_C4", "label": "fillwidth =", "type": "assigned_variable", "loc": [110, 110], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "vector": [14, 2, 0.158, 0.0014, 2, 0.24, 0.5, 198, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fillwidth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fillwidth = tabsize - (tabpos + column) % tabsize"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4", "label": "if", "type": "if", "loc": [112, 115], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "vector": [4, 2, 0.1631, 0.0057, 2, 0.24, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mark_tabs:\n fill = \"\\t\" + \" \" * (fillwidth - 1)\n else:\n fill = \" \" * fillwidth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L113_C6", "label": "fill =", "type": "assigned_variable", "loc": [113, 113], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4", "vector": [14, 3, 0.1624, 0.0014, 3, 0.39, 0.0, 346, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fill", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fill = \"\\t\" + \" \" * (fillwidth - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L115_C6", "label": "fill =", "type": "assigned_variable", "loc": [115, 115], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4", "vector": [14, 3, 0.1652, 0.0014, 3, 0.39, 1.0, 346, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fill", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fill = \" \" * fillwidth"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L117_C4", "label": "text =", "type": "assigned_variable", "loc": [117, 117], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "vector": [14, 2, 0.1681, 0.0014, 2, 0.24, 1.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[tabpos+1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L118_C2", "label": "return", "type": "return", "loc": [118, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "vector": [13, 1, 0.1695, 0.0014, 1, 0.94, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return expanded + text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "label": "Break", "type": "function", "loc": [121, 169], "level": 0, "parent": null, "vector": [2, 0, 0.2083, 0.0704, 0, 0.66, 0.4074, 654, 0, 6, 1, 0, 0, 0, 13], "semantic": {"name": "Break", "arg_names": ["text", "offset", "limit", "brk", "tabsize", "mark_tabs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def Break(text, offset=0, limit=80, brk=\"\\n \", tabsize=8, mark_tabs=False):\n \"\"\"Break text into lines.\n\n Break text, which begins at column offset, each time it reaches\n column limit.\n\n To break the text, insert brk, which does not count toward\n the column count of the next line and is assumed to be valid HTML."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L122_C2", "label": "expression", "type": "expression", "loc": [122, 143], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [8, 1, 0.1904, 0.0316, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Break text into lines.\n\n Break text, which begins at column offset, each time it reaches\n column limit.\n\n To break the text, insert brk, which does not count toward\n the column count of the next line and is assumed to be valid HTML.\n "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L145_C2", "label": "if", "type": "if", "loc": [145, 146], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [4, 1, 0.2091, 0.0029, 1, 0.61, 0.1429, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if text.endswith(\"\\n\"):\n text = text[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L146_C4", "label": "text =", "type": "assigned_variable", "loc": [146, 146], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L145_C2", "vector": [14, 2, 0.2098, 0.0014, 2, 0.21, 0.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L147_C2", "label": "try", "type": "try", "loc": [147, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [7, 1, 0.2134, 0.0057, 1, 0.61, 0.2857, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n text = unicode(text, \"utf-8\")\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L148_C4", "label": "text = unicode()", "type": "assigned_variable", "loc": [148, 148], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L147_C2", "vector": [14, 2, 0.2126, 0.0014, 2, 0.74, 0.0, 439, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " text = unicode(text, \"utf-8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L154_C2", "label": "text = _ExpandTabs()", "type": "assigned_variable", "loc": [154, 154], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [14, 1, 0.2213, 0.0014, 1, 0.61, 0.4286, 439, 3, 4, 0, 0, 975, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "_ExpandTabs", "annotation": ""}, "snippet": " text = _ExpandTabs(text, offset, tabsize, mark_tabs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "label": "if", "type": "if", "loc": [156, 164], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [4, 1, 0.2299, 0.0129, 1, 0.61, 0.5714, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(text) > limit - offset:\n parts, text = [text[0:limit-offset]], text[limit-offset:]\n while len(text) > limit:\n parts.append(text[0:limit])\n text = text[limit:]\n parts.append(text)\n text = brk.join([cgi.escape(p) for p in parts])\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L157_C4", "label": "parts, text =", "type": "assigned_variable", "loc": [157, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "vector": [14, 2, 0.2256, 0.0014, 2, 0.72, 0.0, 486, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "parts, text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " parts, text = [text[0:limit-offset]], text[limit-offset:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4", "label": "while", "type": "while", "loc": [158, 160], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "vector": [5, 2, 0.2284, 0.0043, 2, 0.72, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while len(text) > limit:\n parts.append(text[0:limit])\n text = text[limit:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L159_C6", "label": "append()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4", "vector": [8, 3, 0.2284, 0.0014, 3, 0.61, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " parts.append(text[0:limit])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L160_C6", "label": "text =", "type": "assigned_variable", "loc": [160, 160], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4", "vector": [14, 3, 0.2299, 0.0014, 3, 0.61, 1.0, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = text[limit:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L161_C4", "label": "append()", "type": "expression", "loc": [161, 161], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "vector": [8, 2, 0.2313, 0.0014, 2, 0.72, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " parts.append(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L162_C4", "label": "text = join()", "type": "assigned_variable", "loc": [162, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "vector": [14, 2, 0.2328, 0.0014, 2, 0.72, 0.75, 439, 3, 1, 0, 0, 933, 10, 2], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " text = brk.join([cgi.escape(p) for p in parts])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L164_C4", "label": "text = escape()", "type": "assigned_variable", "loc": [164, 164], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "vector": [14, 2, 0.2356, 0.0014, 2, 0.72, 1.0, 439, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": " text = cgi.escape(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L166_C2", "label": "text = replace()", "type": "assigned_variable", "loc": [166, 166], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [14, 1, 0.2385, 0.0014, 1, 0.61, 0.7143, 439, 3, 2, 0, 0, 293, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " text = text.replace(\"\\t\", TAB_TAG)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L167_C2", "label": "if", "type": "if", "loc": [167, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [4, 1, 0.2407, 0.0029, 1, 0.61, 0.8571, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(text, unicode):\n return text.encode(\"utf-8\", \"replace\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L168_C4", "label": "return", "type": "return", "loc": [168, 168], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L167_C2", "vector": [13, 2, 0.2414, 0.0014, 2, 0.15, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text.encode(\"utf-8\", \"replace\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L169_C2", "label": "return", "type": "return", "loc": [169, 169], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "vector": [13, 1, 0.2428, 0.0014, 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 text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "label": "CompactBlocks", "type": "function", "loc": [172, 199], "level": 0, "parent": null, "vector": [2, 0, 0.2665, 0.0402, 0, 0.66, 0.4444, 8, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "CompactBlocks", "arg_names": ["blocks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def CompactBlocks(blocks):\n \"\"\"Compacts adjacent code blocks.\n\n In many cases 2 adjacent blocks can be merged into one. This allows\n to do some further processing on those blocks.\n\n Args:\n blocks: [(offset1, size), ...]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L173_C2", "label": "expression", "type": "expression", "loc": [173, 187], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [8, 1, 0.2586, 0.0216, 1, 0.88, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Compacts adjacent code blocks.\n\n In many cases 2 adjacent blocks can be merged into one. This allows\n to do some further processing on those blocks.\n\n Args:\n blocks: [(offset1, size), ...]\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L188_C2", "label": "if", "type": "if", "loc": [188, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [4, 1, 0.2708, 0.0029, 1, 0.88, 0.2, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(blocks) == 1:\n return blocks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L189_C4", "label": "return", "type": "return", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L188_C2", "vector": [13, 2, 0.2716, 0.0014, 2, 0.38, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return blocks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L190_C2", "label": "result =", "type": "assigned_variable", "loc": [190, 190], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [14, 1, 0.273, 0.0014, 1, 0.88, 0.4, 51, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result = [blocks[0]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "label": "for block", "type": "for", "loc": [191, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [6, 1, 0.2787, 0.0101, 1, 0.88, 0.6, 506, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "block", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for block in blocks[1:-1]:\n last_start, last_len = result[-1]\n curr_start, curr_len = block\n if last_start + last_len == curr_start:\n result[-1] = last_start, last_len + curr_len\n else:\n result.append(block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L192_C4", "label": "last_start, last_len =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "vector": [14, 2, 0.2759, 0.0014, 2, 0.66, 0.0, 504, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_start, last_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_start, last_len = result[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L193_C4", "label": "curr_start, curr_len =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "vector": [14, 2, 0.2773, 0.0014, 2, 0.66, 0.5, 560, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "curr_start, curr_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " curr_start, curr_len = block"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4", "label": "if", "type": "if", "loc": [194, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "vector": [4, 2, 0.2809, 0.0057, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if last_start + last_len == curr_start:\n result[-1] = last_start, last_len + curr_len\n else:\n result.append(block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L195_C6", "label": "assign", "type": "assigned_variable", "loc": [195, 195], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4", "vector": [14, 3, 0.2802, 0.0014, 3, 0.2, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " result[-1] = last_start, last_len + curr_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L197_C6", "label": "append()", "type": "expression", "loc": [197, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4", "vector": [8, 3, 0.283, 0.0014, 3, 0.2, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L198_C2", "label": "append()", "type": "expression", "loc": [198, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [8, 1, 0.2845, 0.0014, 1, 0.88, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(blocks[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L199_C2", "label": "return", "type": "return", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "vector": [13, 1, 0.2859, 0.0014, 1, 0.88, 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_1183:FunctionDef_L202_C0", "label": "FilterBlocks", "type": "function", "loc": [202, 217], "level": 0, "parent": null, "vector": [2, 0, 0.301, 0.023, 0, 0.66, 0.4815, 682, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "FilterBlocks", "arg_names": ["blocks", "filter_func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def FilterBlocks(blocks, filter_func):\n \"\"\"Gets rid of any blocks if filter_func evaluates false for them.\n\n Args:\n blocks: [(offset1, offset2, size), ...]; must have at least 1 entry\n filter_func: a boolean function taking a single argument of the form\n (offset1, offset2, size)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L203_C2", "label": "expression", "type": "expression", "loc": [203, 213], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "vector": [8, 1, 0.2989, 0.0158, 1, 0.61, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Gets rid of any blocks if filter_func evaluates false for them.\n\n Args:\n blocks: [(offset1, offset2, size), ...]; must have at least 1 entry\n filter_func: a boolean function taking a single argument of the form\n (offset1, offset2, size)\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L215_C2", "label": "res =", "type": "assigned_variable", "loc": [215, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "vector": [14, 1, 0.3089, 0.0014, 1, 0.61, 0.3333, 413, 5, 0, 0, 0, 0, 0, 1], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = [b for b in blocks[:-1] if filter_func(b)]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L216_C2", "label": "append()", "type": "expression", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "vector": [8, 1, 0.3103, 0.0014, 1, 0.61, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " res.append(blocks[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L217_C2", "label": "return", "type": "return", "loc": [217, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "vector": [13, 1, 0.3118, 0.0014, 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 res"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L220_C0", "label": "GetDiffParams", "type": "function", "loc": [220, 240], "level": 0, "parent": null, "vector": [2, 0, 0.3305, 0.0302, 0, 0.66, 0.5185, 303, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "GetDiffParams", "arg_names": ["expr", "min_match_ratio", "min_match_size", "dbg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetDiffParams(expr='d', min_match_ratio=0.6, min_match_size=2, dbg=False):\n \"\"\"Returns a tuple of various parameters which affect intra region diffs.\n\n Args:\n expr: regular expression id to use to identify 'words' in the intra region\n diff\n min_match_ratio: minimum similarity between regions to qualify for intra\n region diff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L221_C2", "label": "expression", "type": "expression", "loc": [221, 236], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L220_C0", "vector": [8, 1, 0.3283, 0.023, 1, 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 of various parameters which affect intra region diffs.\n\n Args:\n expr: regular expression id to use to identify 'words' in the intra region\n diff\n min_match_ratio: minimum similarity between regions to qualify for intra\n region diff\n min_match_size: the smallest matching block size to use. Blocks smaller"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L240_C2", "label": "return", "type": "return", "loc": [240, 240], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L220_C0", "vector": [13, 1, 0.3448, 0.0014, 1, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (expr, min_match_ratio, min_match_size, dbg)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "label": "CanDoIRDiff", "type": "function", "loc": [243, 262], "level": 0, "parent": null, "vector": [2, 0, 0.3628, 0.0287, 0, 0.66, 0.5556, 493, 0, 2, 1, 0, 0, 0, 4], "semantic": {"name": "CanDoIRDiff", "arg_names": ["old_lines", "new_lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def CanDoIRDiff(old_lines, new_lines):\n \"\"\"Tells if it would be worth computing the intra region diff.\n\n Calculating IR diff is costly and is usually helpful only for small regions.\n We use a heuristic that if the total number of characters is more than a\n certain threshold then we assume it is not worth computing the IR diff.\n\n Args:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L244_C2", "label": "expression", "type": "expression", "loc": [244, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "vector": [8, 1, 0.3614, 0.023, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Tells if it would be worth computing the intra region diff.\n\n Calculating IR diff is costly and is usually helpful only for small regions.\n We use a heuristic that if the total number of characters is more than a\n certain threshold then we assume it is not worth computing the IR diff.\n\n Args:\n old_lines: an array of strings containing old text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L260_C2", "label": "total_chars =", "type": "assigned_variable", "loc": [260, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "vector": [14, 1, 0.3743, 0.0029, 1, 0.06, 0.5, 719, 4, 0, 0, 0, 0, 0, 4], "semantic": {"name": "total_chars", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_chars = (sum(len(line) for line in old_lines) +\n sum(len(line) for line in new_lines))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L262_C2", "label": "return", "type": "return", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "vector": [13, 1, 0.3764, 0.0014, 1, 0.06, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return total_chars <= MAX_TOTAL_LEN"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "label": "WordDiff", "type": "function", "loc": [265, 337], "level": 0, "parent": null, "vector": [2, 0, 0.4325, 0.1049, 0, 0.66, 0.5926, 545, 0, 3, 1, 0, 0, 0, 21], "semantic": {"name": "WordDiff", "arg_names": ["line1", "line2", "diff_params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def WordDiff(line1, line2, diff_params):\n \"\"\"Returns blocks with positions indiciating word level diffs.\n\n Args:\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n diff_params: return value of GetDiffParams\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L266_C2", "label": "expression", "type": "expression", "loc": [266, 279], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [8, 1, 0.3915, 0.0201, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns blocks with positions indiciating word level diffs.\n\n Args:\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n diff_params: return value of GetDiffParams\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L280_C2", "label": "match_expr, min_match_ratio, min_match_size, _ =", "type": "assigned_variable", "loc": [280, 280], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4023, 0.0014, 1, 0.25, 0.0435, 483, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "match_expr, min_match_ratio, min_match_size, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " match_expr, min_match_ratio, min_match_size, _ = diff_params"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L281_C2", "label": "exp =", "type": "assigned_variable", "loc": [281, 281], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4037, 0.0014, 1, 0.25, 0.087, 971, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "exp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " exp = EXPRS[match_expr]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L283_C2", "label": "try", "type": "try", "loc": [283, 286], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [7, 1, 0.4088, 0.0057, 1, 0.25, 0.1304, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n line1 = unicode(line1, \"utf8\")\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L284_C4", "label": "line1 = unicode()", "type": "assigned_variable", "loc": [284, 284], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L283_C2", "vector": [14, 2, 0.408, 0.0014, 2, 0.25, 0.0, 106, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "line1", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " line1 = unicode(line1, \"utf8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L287_C2", "label": "try", "type": "try", "loc": [287, 290], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [7, 1, 0.4145, 0.0057, 1, 0.25, 0.1739, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n line2 = unicode(line2, \"utf8\")\n except:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L288_C4", "label": "line2 = unicode()", "type": "assigned_variable", "loc": [288, 288], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L287_C2", "vector": [14, 2, 0.4138, 0.0014, 2, 0.72, 0.0, 905, 3, 2, 0, 0, 733, 10, 1], "semantic": {"name": "line2", "arg_names": [], "import_names": [], "rhs_call_name": "unicode", "annotation": ""}, "snippet": " line2 = unicode(line2, \"utf8\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L292_C2", "label": "a = findall()", "type": "assigned_variable", "loc": [292, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4195, 0.0014, 1, 0.25, 0.2174, 475, 3, 3, 0, 0, 737, 10, 1], "semantic": {"name": "a", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " a = re.findall(exp, line1, re.U)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L293_C2", "label": "b = findall()", "type": "assigned_variable", "loc": [293, 293], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.421, 0.0014, 1, 0.25, 0.2609, 756, 3, 3, 0, 0, 737, 10, 1], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "findall", "annotation": ""}, "snippet": " b = re.findall(exp, line2, re.U)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L294_C2", "label": "s = SequenceMatcher()", "type": "assigned_variable", "loc": [294, 294], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4224, 0.0014, 1, 0.25, 0.3043, 553, 3, 3, 0, 0, 54, 10, 1], "semantic": {"name": "s", "arg_names": [], "import_names": [], "rhs_call_name": "SequenceMatcher", "annotation": ""}, "snippet": " s = difflib.SequenceMatcher(None, a, b)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L295_C2", "label": "matching_blocks = get_matching_blocks()", "type": "assigned_variable", "loc": [295, 295], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4239, 0.0014, 1, 0.25, 0.3478, 281, 3, 0, 0, 0, 34, 10, 1], "semantic": {"name": "matching_blocks", "arg_names": [], "import_names": [], "rhs_call_name": "get_matching_blocks", "annotation": ""}, "snippet": " matching_blocks = s.get_matching_blocks()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L296_C2", "label": "ratio = ratio()", "type": "assigned_variable", "loc": [296, 296], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4253, 0.0014, 1, 0.25, 0.3913, 188, 3, 0, 0, 0, 188, 10, 1], "semantic": {"name": "ratio", "arg_names": [], "import_names": [], "rhs_call_name": "ratio", "annotation": ""}, "snippet": " ratio = s.ratio()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L304_C2", "label": "if", "type": "if", "loc": [304, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [4, 1, 0.4375, 0.0029, 1, 0.25, 0.4348, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ratio < min_match_ratio and len(matching_blocks) > 3:\n return ([(0, 0, 0)], ratio)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L305_C4", "label": "return", "type": "return", "loc": [305, 305], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L304_C2", "vector": [13, 2, 0.4382, 0.0014, 2, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ([(0, 0, 0)], ratio)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L310_C2", "label": "lena =", "type": "assigned_variable", "loc": [310, 310], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4454, 0.0014, 1, 0.25, 0.4783, 804, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lena", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lena = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L311_C2", "label": "last =", "type": "assigned_variable", "loc": [311, 311], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4468, 0.0014, 1, 0.25, 0.5217, 95, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L312_C2", "label": "for w", "type": "for", "loc": [312, 314], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [6, 1, 0.4497, 0.0043, 1, 0.25, 0.5652, 549, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for w in a:\n lena.append(last)\n last += len(w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L313_C4", "label": "append()", "type": "expression", "loc": [313, 313], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L312_C2", "vector": [8, 2, 0.4497, 0.0014, 2, 0.62, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lena.append(last)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L315_C2", "label": "lenb =", "type": "assigned_variable", "loc": [315, 315], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4526, 0.0014, 1, 0.25, 0.6087, 996, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "lenb", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lenb = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L316_C2", "label": "last =", "type": "assigned_variable", "loc": [316, 316], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.454, 0.0014, 1, 0.25, 0.6522, 95, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L317_C2", "label": "for w", "type": "for", "loc": [317, 319], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [6, 1, 0.4569, 0.0043, 1, 0.25, 0.6957, 549, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "w", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for w in b:\n lenb.append(last)\n last += len(w)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L318_C4", "label": "append()", "type": "expression", "loc": [318, 318], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L317_C2", "vector": [8, 2, 0.4569, 0.0014, 2, 0.75, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lenb.append(last)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L320_C2", "label": "append()", "type": "expression", "loc": [320, 320], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [8, 1, 0.4598, 0.0014, 1, 0.25, 0.7391, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lena.append(len(line1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L321_C2", "label": "append()", "type": "expression", "loc": [321, 321], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [8, 1, 0.4612, 0.0014, 1, 0.25, 0.7826, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lenb.append(len(line2))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L323_C2", "label": "blocks =", "type": "assigned_variable", "loc": [323, 323], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.4641, 0.0014, 1, 0.25, 0.8261, 384, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blocks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "label": "for s1, s2, blen", "type": "for", "loc": [324, 328], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [6, 1, 0.4684, 0.0072, 1, 0.25, 0.8696, 104, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "s1, s2, blen", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for s1, s2, blen in matching_blocks[:-1]:\n apos = lena[s1]\n bpos = lenb[s2]\n block_len = lena[s1+blen] - apos\n blocks.append((apos, bpos, block_len))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L325_C4", "label": "apos =", "type": "assigned_variable", "loc": [325, 325], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "vector": [14, 2, 0.467, 0.0014, 2, 0.65, 0.0, 95, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "apos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " apos = lena[s1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L326_C4", "label": "bpos =", "type": "assigned_variable", "loc": [326, 326], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "vector": [14, 2, 0.4684, 0.0014, 2, 0.65, 0.3333, 937, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bpos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bpos = lenb[s2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L327_C4", "label": "block_len =", "type": "assigned_variable", "loc": [327, 327], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "vector": [14, 2, 0.4698, 0.0014, 2, 0.65, 0.6667, 94, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "block_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " block_len = lena[s1+blen] - apos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L328_C4", "label": "append()", "type": "expression", "loc": [328, 328], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "vector": [8, 2, 0.4713, 0.0014, 2, 0.65, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blocks.append((apos, bpos, block_len))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L330_C2", "label": "append()", "type": "expression", "loc": [330, 330], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [8, 1, 0.4741, 0.0014, 1, 0.25, 0.913, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blocks.append((len(line1), len(line2), 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L335_C2", "label": "blocks = FilterBlocks()", "type": "assigned_variable", "loc": [335, 336], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [14, 1, 0.482, 0.0029, 1, 0.25, 0.9565, 384, 3, 2, 0, 0, 682, 10, 1], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "FilterBlocks", "annotation": ""}, "snippet": " blocks = FilterBlocks(blocks, lambda b: (b[2] >= min_match_size or\n line1[b[0]:b[0]+b[2]] == '\\n'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L337_C2", "label": "return", "type": "return", "loc": [337, 337], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "vector": [13, 1, 0.4842, 0.0014, 1, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (blocks, ratio)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "label": "IntraLineDiff", "type": "function", "loc": [340, 358], "level": 0, "parent": null, "vector": [2, 0, 0.5014, 0.0273, 0, 0.66, 0.6296, 806, 0, 4, 1, 0, 0, 0, 1], "semantic": {"name": "IntraLineDiff", "arg_names": ["line1", "line2", "diff_params", "diff_func"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def IntraLineDiff(line1, line2, diff_params, diff_func=WordDiff):\n \"\"\"Computes intraline diff blocks.\n\n Args:\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n diff_params: return value of GetDiffParams\n diff_func: a function whose signature matches that of WordDiff() above"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L341_C2", "label": "expression", "type": "expression", "loc": [341, 353], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "vector": [8, 1, 0.4986, 0.0187, 1, 0.45, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Computes intraline diff blocks.\n\n Args:\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n diff_params: return value of GetDiffParams\n diff_func: a function whose signature matches that of WordDiff() above\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L354_C2", "label": "blocks, ratio = diff_func()", "type": "assigned_variable", "loc": [354, 354], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "vector": [14, 1, 0.5086, 0.0014, 1, 0.45, 0.25, 848, 3, 3, 0, 0, 980, 10, 1], "semantic": {"name": "blocks, ratio", "arg_names": [], "import_names": [], "rhs_call_name": "diff_func", "annotation": ""}, "snippet": " blocks, ratio = diff_func(line1, line2, diff_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L355_C2", "label": "blocks1 =", "type": "assigned_variable", "loc": [355, 355], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "vector": [14, 1, 0.5101, 0.0014, 1, 0.45, 0.5, 91, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blocks1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blocks1 = [(start1, length) for (start1, start2, length) in blocks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L356_C2", "label": "blocks2 =", "type": "assigned_variable", "loc": [356, 356], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "vector": [14, 1, 0.5115, 0.0014, 1, 0.45, 0.75, 793, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blocks2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blocks2 = [(start2, length) for (start1, start2, length) in blocks]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L358_C2", "label": "return", "type": "return", "loc": [358, 358], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "vector": [13, 1, 0.5144, 0.0014, 1, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (blocks1, blocks2, ratio)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L361_C0", "label": "DumpDiff", "type": "function", "loc": [361, 372], "level": 0, "parent": null, "vector": [2, 0, 0.5266, 0.0172, 0, 0.66, 0.6667, 977, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "DumpDiff", "arg_names": ["blocks", "line1", "line2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def DumpDiff(blocks, line1, line2):\n \"\"\"Helper function to debug diff related problems.\n\n Args:\n blocks: [(offset1, offset2, size), ...]\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L362_C2", "label": "expression", "type": "expression", "loc": [362, 368], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L361_C0", "vector": [8, 1, 0.5244, 0.0101, 1, 0.98, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper function to debug diff related problems.\n\n Args:\n blocks: [(offset1, offset2, size), ...]\n line1: string representing the left part of the diff\n line2: string representing the right part of the diff\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "label": "for offset1, offset2, size", "type": "for", "loc": [369, 372], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L361_C0", "vector": [6, 1, 0.5323, 0.0057, 1, 0.98, 1.0, 249, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "offset1, offset2, size", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for offset1, offset2, size in blocks:\n print(offset1, offset2, size)\n print(offset1, size, \": \", line1[offset1:offset1+size])\n print(offset2, size, \": \", line2[offset2:offset2+size])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L370_C4", "label": "print()", "type": "expression", "loc": [370, 370], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "vector": [8, 2, 0.5316, 0.0014, 2, 0.15, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(offset1, offset2, size)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L371_C4", "label": "print()", "type": "expression", "loc": [371, 371], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "vector": [8, 2, 0.533, 0.0014, 2, 0.15, 0.5, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(offset1, size, \": \", line1[offset1:offset1+size])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L372_C4", "label": "print()", "type": "expression", "loc": [372, 372], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "vector": [8, 2, 0.5345, 0.0014, 2, 0.15, 1.0, 535, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(offset2, size, \": \", line2[offset2:offset2+size])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "label": "RenderIntraLineDiff", "type": "function", "loc": [375, 417], "level": 0, "parent": null, "vector": [2, 0, 0.569, 0.0618, 0, 0.66, 0.7037, 875, 0, 8, 1, 0, 0, 0, 5], "semantic": {"name": "RenderIntraLineDiff", "arg_names": ["blocks", "line", "tag", "dbg_info", "limit", "indent", "tabsize", "mark_tabs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RenderIntraLineDiff(blocks, line, tag, dbg_info=None, limit=80, indent=5,\n tabsize=8, mark_tabs=False):\n \"\"\"Renders the diff blocks returned by IntraLineDiff function.\n\n Args:\n blocks: [(start_pos, size), ...]\n line: line of code on which the blocks are to be rendered.\n tag: 'new' or 'old' to control the color scheme."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L377_C2", "label": "expression", "type": "expression", "loc": [377, 394], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [8, 1, 0.5539, 0.0259, 1, 0.81, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Renders the diff blocks returned by IntraLineDiff function.\n\n Args:\n blocks: [(start_pos, size), ...]\n line: line of code on which the blocks are to be rendered.\n tag: 'new' or 'old' to control the color scheme.\n dbg_info: a string that holds debugging informaion header. Debug\n information is rendered only if dbg_info is not None."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L395_C2", "label": "res =", "type": "assigned_variable", "loc": [395, 395], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [14, 1, 0.5675, 0.0014, 1, 0.81, 0.1429, 413, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "res", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " res = \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L396_C2", "label": "prev_start, prev_len =", "type": "assigned_variable", "loc": [396, 396], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [14, 1, 0.569, 0.0014, 1, 0.81, 0.2857, 824, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "prev_start, prev_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_start, prev_len = 0, 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L397_C2", "label": "has_newline =", "type": "assigned_variable", "loc": [397, 397], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [14, 1, 0.5704, 0.0014, 1, 0.81, 0.4286, 480, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_newline", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_newline = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L398_C2", "label": "debug_info =", "type": "assigned_variable", "loc": [398, 398], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [14, 1, 0.5718, 0.0014, 1, 0.81, 0.5714, 90, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "debug_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " debug_info = dbg_info"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L399_C2", "label": "if", "type": "if", "loc": [399, 400], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [4, 1, 0.574, 0.0029, 1, 0.81, 0.7143, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dbg_info:\n debug_info += \"\\nBlock Count: %d\\nBlocks: \" % (len(blocks) - 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "label": "for curr_start, curr_len", "type": "for", "loc": [401, 416], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [6, 1, 0.5869, 0.023, 1, 0.81, 0.8571, 560, 2, 0, 0, 0, 0, 0, 4], "semantic": {"name": "curr_start, curr_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for curr_start, curr_len in blocks:\n if dbg_info and curr_len > 0:\n debug_info += Break(\n \"\\n(%d, %d):|%s|\" %\n (curr_start, curr_len, line[curr_start:curr_start+curr_len]),\n limit, indent, tabsize, mark_tabs)\n res += FoldBlock(line, prev_start + prev_len, curr_start, limit, indent,\n tag, 'diff', tabsize, mark_tabs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L402_C4", "label": "if", "type": "if", "loc": [402, 406], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "vector": [4, 2, 0.5805, 0.0072, 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 dbg_info and curr_len > 0:\n debug_info += Break(\n \"\\n(%d, %d):|%s|\" %\n (curr_start, curr_len, line[curr_start:curr_start+curr_len]),\n limit, indent, tabsize, mark_tabs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L414_C4", "label": "if", "type": "if", "loc": [414, 415], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "vector": [4, 2, 0.5955, 0.0029, 2, 0.62, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line[curr_start:curr_start+curr_len].endswith('\\n'):\n has_newline = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L415_C6", "label": "has_newline =", "type": "assigned_variable", "loc": [415, 415], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L414_C4", "vector": [14, 3, 0.5963, 0.0014, 3, 0.45, 0.0, 480, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "has_newline", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " has_newline = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L416_C4", "label": "prev_start, prev_len =", "type": "assigned_variable", "loc": [416, 416], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "vector": [14, 2, 0.5977, 0.0014, 2, 0.62, 1.0, 824, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "prev_start, prev_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_start, prev_len = curr_start, curr_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L417_C2", "label": "return", "type": "return", "loc": [417, 417], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "vector": [13, 1, 0.5991, 0.0014, 1, 0.81, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (res, has_newline, debug_info)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "label": "FoldBlock", "type": "function", "loc": [420, 459], "level": 0, "parent": null, "vector": [2, 0, 0.6315, 0.0575, 0, 0.66, 0.7407, 267, 0, 9, 1, 0, 0, 0, 4], "semantic": {"name": "FoldBlock", "arg_names": ["src", "start", "end", "limit", "indent", "tag", "btype", "tabsize", "mark_tabs"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def FoldBlock(src, start, end, limit, indent, tag, btype, tabsize=8,\n mark_tabs=False):\n \"\"\"Folds and renders a block.\n\n Args:\n src: line of code\n start: starting position of the block within 'src'.\n end: ending position of the block within 'src'."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L422_C2", "label": "expression", "type": "expression", "loc": [422, 437], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [8, 1, 0.6171, 0.023, 1, 0.78, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Folds and renders a block.\n\n Args:\n src: line of code\n start: starting position of the block within 'src'.\n end: ending position of the block within 'src'.\n limit: folding limit\n indent: indentation to use for folding."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L438_C2", "label": "text =", "type": "assigned_variable", "loc": [438, 438], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [14, 1, 0.6293, 0.0014, 1, 0.78, 0.1111, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = src[start:end]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L442_C2", "label": "if", "type": "if", "loc": [442, 443], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [4, 1, 0.6358, 0.0029, 1, 0.78, 0.2222, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if start >= end or text == '\\n':\n return \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L443_C4", "label": "return", "type": "return", "loc": [443, 443], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L442_C2", "vector": [13, 2, 0.6365, 0.0014, 2, 0.52, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return \"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L444_C2", "label": "fbegin, lend, nl_plus_indent = GetTags()", "type": "assigned_variable", "loc": [444, 444], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [14, 1, 0.6379, 0.0014, 1, 0.78, 0.3333, 436, 3, 3, 0, 0, 868, 10, 1], "semantic": {"name": "fbegin, lend, nl_plus_indent", "arg_names": [], "import_names": [], "rhs_call_name": "GetTags", "annotation": ""}, "snippet": " fbegin, lend, nl_plus_indent = GetTags(tag, btype, indent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L450_C2", "label": "offset_from_bol =", "type": "assigned_variable", "loc": [450, 450], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [14, 1, 0.6466, 0.0014, 1, 0.78, 0.4444, 200, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "offset_from_bol", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " offset_from_bol = len(_ExpandTabs(src[0:start], 0, tabsize)) % limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L451_C2", "label": "brk =", "type": "assigned_variable", "loc": [451, 451], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [14, 1, 0.648, 0.0014, 1, 0.78, 0.5556, 36, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "brk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " brk = lend + nl_plus_indent + fbegin"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L452_C2", "label": "text = Break()", "type": "assigned_variable", "loc": [452, 452], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [14, 1, 0.6494, 0.0014, 1, 0.78, 0.6667, 439, 3, 6, 0, 0, 654, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "Break", "annotation": ""}, "snippet": " text = Break(text, offset_from_bol, limit, brk, tabsize, mark_tabs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L453_C2", "label": "if", "type": "if", "loc": [453, 454], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [4, 1, 0.6516, 0.0029, 1, 0.78, 0.7778, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if text:\n text = fbegin + text + lend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L454_C4", "label": "text =", "type": "assigned_variable", "loc": [454, 454], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L453_C2", "vector": [14, 2, 0.6523, 0.0014, 2, 0.79, 0.0, 439, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = fbegin + text + lend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L457_C2", "label": "if", "type": "if", "loc": [457, 458], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [4, 1, 0.6573, 0.0029, 1, 0.78, 0.8889, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if offset_from_bol == 0 and not start == 0:\n text = nl_plus_indent + text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L458_C4", "label": "text =", "type": "assigned_variable", "loc": [458, 458], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L457_C2", "vector": [14, 2, 0.658, 0.0014, 2, 0.01, 0.0, 439, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = nl_plus_indent + text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L459_C2", "label": "return", "type": "return", "loc": [459, 459], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "vector": [13, 1, 0.6595, 0.0014, 1, 0.78, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "label": "GetTags", "type": "function", "loc": [462, 480], "level": 0, "parent": null, "vector": [2, 0, 0.6767, 0.0273, 0, 0.66, 0.7778, 868, 0, 3, 1, 0, 0, 0, 1], "semantic": {"name": "GetTags", "arg_names": ["tag", "btype", "indent"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetTags(tag, btype, indent):\n \"\"\"Returns various tags for rendering diff blocks.\n\n Args:\n tag: a key from COLOR_SCHEME\n btype: 'match' or 'diff'\n indent: indentation to use\n Returns"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L463_C2", "label": "expression", "type": "expression", "loc": [463, 471], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [8, 1, 0.671, 0.0129, 1, 0.15, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns various tags for rendering diff blocks.\n\n Args:\n tag: a key from COLOR_SCHEME\n btype: 'match' or 'diff'\n indent: indentation to use\n Returns\n A 3 tuple (begin_tag, end_tag, formatted_indent_block)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L474_C2", "label": "fbegin =", "type": "assigned_variable", "loc": [474, 474], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [14, 1, 0.681, 0.0014, 1, 0.15, 0.1667, 511, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "fbegin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " fbegin = BEGIN_TAG % COLOR_SCHEME[tag][btype]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L475_C2", "label": "bbegin =", "type": "assigned_variable", "loc": [475, 475], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [14, 1, 0.6825, 0.0014, 1, 0.15, 0.3333, 573, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "bbegin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " bbegin = BEGIN_TAG % COLOR_SCHEME[tag]['bckgrnd']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L476_C2", "label": "lend =", "type": "assigned_variable", "loc": [476, 476], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [14, 1, 0.6839, 0.0014, 1, 0.15, 0.5, 574, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lend = END_TAG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L477_C2", "label": "nl_plus_indent =", "type": "assigned_variable", "loc": [477, 477], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [14, 1, 0.6853, 0.0014, 1, 0.15, 0.6667, 442, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "nl_plus_indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nl_plus_indent = '\\n'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L478_C2", "label": "if", "type": "if", "loc": [478, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [4, 1, 0.6875, 0.0029, 1, 0.15, 0.8333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if indent > 0:\n nl_plus_indent += bbegin + cgi.escape(\" \"*indent) + lend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L480_C2", "label": "return", "type": "return", "loc": [480, 480], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "vector": [13, 1, 0.6897, 0.0014, 1, 0.15, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return fbegin, lend, nl_plus_indent"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "label": "ConvertToSingleLine", "type": "function", "loc": [483, 512], "level": 0, "parent": null, "vector": [2, 0, 0.7148, 0.0431, 0, 0.66, 0.8148, 705, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "ConvertToSingleLine", "arg_names": ["lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ConvertToSingleLine(lines):\n \"\"\"Transforms a sequence of strings into a single line.\n\n Returns the state that can be used to reconstruct the original lines with\n the newline separators placed at the original place.\n\n Args:\n lines: sequence of strings"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L484_C2", "label": "expression", "type": "expression", "loc": [484, 501], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [8, 1, 0.7076, 0.0259, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Transforms a sequence of strings into a single line.\n\n Returns the state that can be used to reconstruct the original lines with\n the newline separators placed at the original place.\n\n Args:\n lines: sequence of strings\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L502_C2", "label": "state =", "type": "assigned_variable", "loc": [502, 502], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [14, 1, 0.7213, 0.0014, 1, 0.91, 0.2, 688, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "state", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " state = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L503_C2", "label": "total_length =", "type": "assigned_variable", "loc": [503, 503], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [14, 1, 0.7227, 0.0014, 1, 0.91, 0.4, 94, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "total_length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " total_length = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L504_C2", "label": "for l", "type": "for", "loc": [504, 509], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [6, 1, 0.7277, 0.0086, 1, 0.91, 0.6, 810, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "l", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for l in lines:\n total_length += len(l)\n # TODO: Use a tuple instead.\n state.append({'pos': total_length, # the line split point\n 'blocks': [], # blocks which belong to this line\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L507_C4", "label": "append()", "type": "expression", "loc": [507, 509], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L504_C2", "vector": [8, 2, 0.7299, 0.0043, 2, 0.52, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " state.append({'pos': total_length, # the line split point\n 'blocks': [], # blocks which belong to this line\n })"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L510_C2", "label": "result = join()", "type": "assigned_variable", "loc": [510, 510], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [14, 1, 0.7328, 0.0014, 1, 0.91, 0.8, 51, 3, 1, 0, 0, 933, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "join", "annotation": ""}, "snippet": " result = \"\".join(lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L512_C2", "label": "return", "type": "return", "loc": [512, 512], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "vector": [13, 1, 0.7356, 0.0014, 1, 0.91, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (result, state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "label": "MarkBlock", "type": "function", "loc": [515, 548], "level": 0, "parent": null, "vector": [2, 0, 0.7636, 0.0489, 0, 0.66, 0.8519, 358, 0, 3, 0, 0, 0, 0, 3], "semantic": {"name": "MarkBlock", "arg_names": ["state", "begin", "end"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def MarkBlock(state, begin, end):\n \"\"\"Marks a block on a region such that it doesn't cross line boundaries.\n\n It is an operation that can be performed on the single line which was\n returned by the ConvertToSingleLine function. This operation marks arbitrary\n block [begin,end) on the text. It also ensures that if [begin,end) crosses\n line boundaries in the original region then it splits the section up in 2 or\n more blocks such that no block crosses the boundaries."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L516_C2", "label": "expression", "type": "expression", "loc": [516, 532], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "vector": [8, 1, 0.7529, 0.0244, 1, 0.25, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Marks a block on a region such that it doesn't cross line boundaries.\n\n It is an operation that can be performed on the single line which was\n returned by the ConvertToSingleLine function. This operation marks arbitrary\n block [begin,end) on the text. It also ensures that if [begin,end) crosses\n line boundaries in the original region then it splits the section up in 2 or\n more blocks such that no block crosses the boundaries.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L534_C2", "label": "if", "type": "if", "loc": [534, 535], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "vector": [4, 1, 0.768, 0.0029, 1, 0.25, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if begin == end:\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L535_C4", "label": "return", "type": "return", "loc": [535, 535], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L534_C2", "vector": [13, 2, 0.7687, 0.0014, 2, 0.5, 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_1183:Assign_L536_C2", "label": "last_pos =", "type": "assigned_variable", "loc": [536, 536], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "vector": [14, 1, 0.7701, 0.0014, 1, 0.25, 0.6667, 538, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "last_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "label": "for entry", "type": "for", "loc": [537, 548], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "vector": [6, 1, 0.7795, 0.0172, 1, 0.25, 1.0, 812, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in state:\n pos = entry['pos']\n if begin >= last_pos and begin < pos:\n if end < pos:\n # block doesn't cross any line boundary\n entry['blocks'].append((begin, end))\n else:\n # block crosses the line boundary"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L538_C4", "label": "pos =", "type": "assigned_variable", "loc": [538, 538], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "vector": [14, 2, 0.773, 0.0014, 2, 0.81, 0.0, 627, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = entry['pos']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L539_C4", "label": "if", "type": "if", "loc": [539, 547], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "vector": [4, 2, 0.7802, 0.0129, 2, 0.81, 0.5, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if begin >= last_pos and begin < pos:\n if end < pos:\n # block doesn't cross any line boundary\n entry['blocks'].append((begin, end))\n else:\n # block crosses the line boundary\n entry['blocks'].append((begin, pos))\n MarkBlock(state, pos, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "label": "if", "type": "if", "loc": [540, 546], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L539_C4", "vector": [4, 3, 0.7802, 0.0101, 3, 0.38, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if end < pos:\n # block doesn't cross any line boundary\n entry['blocks'].append((begin, end))\n else:\n # block crosses the line boundary\n entry['blocks'].append((begin, pos))\n MarkBlock(state, pos, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L542_C8", "label": "append()", "type": "expression", "loc": [542, 542], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "vector": [8, 4, 0.7787, 0.0014, 4, 0.28, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " entry['blocks'].append((begin, end))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L545_C8", "label": "append()", "type": "expression", "loc": [545, 545], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "vector": [8, 4, 0.783, 0.0014, 4, 0.28, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " entry['blocks'].append((begin, pos))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L546_C8", "label": "MarkBlock()", "type": "expression", "loc": [546, 546], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "vector": [8, 4, 0.7845, 0.0014, 4, 0.28, 1.0, 358, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "MarkBlock", "arg_names": [], "import_names": [], "rhs_call_name": "MarkBlock", "annotation": ""}, "snippet": " MarkBlock(state, pos, end)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L548_C4", "label": "last_pos =", "type": "assigned_variable", "loc": [548, 548], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "vector": [14, 2, 0.7874, 0.0014, 2, 0.81, 1.0, 538, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "label": "GetBlocks", "type": "function", "loc": [551, 571], "level": 0, "parent": null, "vector": [2, 0, 0.806, 0.0302, 0, 0.66, 0.8889, 43, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "GetBlocks", "arg_names": ["state"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def GetBlocks(state):\n \"\"\"Returns all the blocks corresponding to the lines in the region.\n\n Args:\n state: the state returned by ConvertToSingleLine().\n\n Returns:\n An array of [(start_pos, length), ..] with an entry for each line in the"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L552_C2", "label": "expression", "type": "expression", "loc": [552, 560], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "vector": [8, 1, 0.7989, 0.0129, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns all the blocks corresponding to the lines in the region.\n\n Args:\n state: the state returned by ConvertToSingleLine().\n\n Returns:\n An array of [(start_pos, length), ..] with an entry for each line in the\n region."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L561_C2", "label": "result =", "type": "assigned_variable", "loc": [561, 561], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "vector": [14, 1, 0.806, 0.0014, 1, 0.65, 0.25, 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_1183:Assign_L562_C2", "label": "last_pos =", "type": "assigned_variable", "loc": [562, 562], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "vector": [14, 1, 0.8075, 0.0014, 1, 0.65, 0.5, 538, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "last_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "label": "for entry", "type": "for", "loc": [563, 570], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "vector": [6, 1, 0.8139, 0.0115, 1, 0.65, 0.75, 812, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "entry", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for entry in state:\n pos = entry['pos']\n # Calculate block start points from the beginning of individual lines.\n blocks = [(s[0]-last_pos, s[1]-s[0]) for s in entry['blocks']]\n # Add one end marker block.\n blocks.append((pos-last_pos, 0))\n result.append(blocks)\n last_pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L564_C4", "label": "pos =", "type": "assigned_variable", "loc": [564, 564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "vector": [14, 2, 0.8103, 0.0014, 2, 0.28, 0.0, 627, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " pos = entry['pos']"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L566_C4", "label": "blocks =", "type": "assigned_variable", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "vector": [14, 2, 0.8132, 0.0014, 2, 0.28, 0.25, 384, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " blocks = [(s[0]-last_pos, s[1]-s[0]) for s in entry['blocks']]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L568_C4", "label": "append()", "type": "expression", "loc": [568, 568], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "vector": [8, 2, 0.8161, 0.0014, 2, 0.28, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " blocks.append((pos-last_pos, 0))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L569_C4", "label": "append()", "type": "expression", "loc": [569, 569], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "vector": [8, 2, 0.8175, 0.0014, 2, 0.28, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(blocks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L570_C4", "label": "last_pos =", "type": "assigned_variable", "loc": [570, 570], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "vector": [14, 2, 0.819, 0.0014, 2, 0.28, 1.0, 538, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_pos = pos"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L571_C2", "label": "return", "type": "return", "loc": [571, 571], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "vector": [13, 1, 0.8204, 0.0014, 1, 0.65, 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_1183:FunctionDef_L574_C0", "label": "IntraRegionDiff", "type": "function", "loc": [574, 597], "level": 0, "parent": null, "vector": [2, 0, 0.8412, 0.0345, 0, 0.66, 0.9259, 257, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "IntraRegionDiff", "arg_names": ["old_lines", "new_lines", "diff_params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def IntraRegionDiff(old_lines, new_lines, diff_params):\n \"\"\"Computes intra region diff.\n\n Args:\n old_lines: array of strings\n new_lines: array of strings\n diff_params: return value of GetDiffParams\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L575_C2", "label": "expression", "type": "expression", "loc": [575, 585], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [8, 1, 0.8333, 0.0158, 1, 0.94, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Computes intra region diff.\n\n Args:\n old_lines: array of strings\n new_lines: array of strings\n diff_params: return value of GetDiffParams\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L586_C2", "label": "old_line, old_state = ConvertToSingleLine()", "type": "assigned_variable", "loc": [586, 586], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [14, 1, 0.842, 0.0014, 1, 0.94, 0.125, 716, 3, 1, 0, 0, 705, 10, 1], "semantic": {"name": "old_line, old_state", "arg_names": [], "import_names": [], "rhs_call_name": "ConvertToSingleLine", "annotation": ""}, "snippet": " old_line, old_state = ConvertToSingleLine(old_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L587_C2", "label": "new_line, new_state = ConvertToSingleLine()", "type": "assigned_variable", "loc": [587, 587], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [14, 1, 0.8434, 0.0014, 1, 0.94, 0.25, 709, 3, 1, 0, 0, 705, 10, 1], "semantic": {"name": "new_line, new_state", "arg_names": [], "import_names": [], "rhs_call_name": "ConvertToSingleLine", "annotation": ""}, "snippet": " new_line, new_state = ConvertToSingleLine(new_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L588_C2", "label": "old_blocks, new_blocks, ratio = IntraLineDiff()", "type": "assigned_variable", "loc": [588, 588], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [14, 1, 0.8448, 0.0014, 1, 0.94, 0.375, 48, 3, 3, 0, 0, 806, 10, 1], "semantic": {"name": "old_blocks, new_blocks, ratio", "arg_names": [], "import_names": [], "rhs_call_name": "IntraLineDiff", "annotation": ""}, "snippet": " old_blocks, new_blocks, ratio = IntraLineDiff(old_line, new_line, diff_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L589_C2", "label": "for begin, length", "type": "for", "loc": [589, 590], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [6, 1, 0.847, 0.0029, 1, 0.94, 0.5, 104, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "begin, length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for begin, length in old_blocks:\n MarkBlock(old_state, begin, begin+length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L590_C4", "label": "MarkBlock()", "type": "expression", "loc": [590, 590], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L589_C2", "vector": [8, 2, 0.8477, 0.0014, 2, 0.81, 0.0, 358, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "MarkBlock", "arg_names": [], "import_names": [], "rhs_call_name": "MarkBlock", "annotation": ""}, "snippet": " MarkBlock(old_state, begin, begin+length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L591_C2", "label": "old_blocks = GetBlocks()", "type": "assigned_variable", "loc": [591, 591], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [14, 1, 0.8491, 0.0014, 1, 0.94, 0.625, 846, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "old_blocks", "arg_names": [], "import_names": [], "rhs_call_name": "GetBlocks", "annotation": ""}, "snippet": " old_blocks = GetBlocks(old_state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L593_C2", "label": "for begin, length", "type": "for", "loc": [593, 594], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [6, 1, 0.8527, 0.0029, 1, 0.94, 0.75, 104, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "begin, length", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for begin, length in new_blocks:\n MarkBlock(new_state, begin, begin+length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L594_C4", "label": "MarkBlock()", "type": "expression", "loc": [594, 594], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L593_C2", "vector": [8, 2, 0.8534, 0.0014, 2, 0.7, 0.0, 358, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "MarkBlock", "arg_names": [], "import_names": [], "rhs_call_name": "MarkBlock", "annotation": ""}, "snippet": " MarkBlock(new_state, begin, begin+length)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L595_C2", "label": "new_blocks = GetBlocks()", "type": "assigned_variable", "loc": [595, 595], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [14, 1, 0.8549, 0.0014, 1, 0.94, 0.875, 644, 3, 1, 0, 0, 43, 10, 1], "semantic": {"name": "new_blocks", "arg_names": [], "import_names": [], "rhs_call_name": "GetBlocks", "annotation": ""}, "snippet": " new_blocks = GetBlocks(new_state)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L597_C2", "label": "return", "type": "return", "loc": [597, 597], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "vector": [13, 1, 0.8578, 0.0014, 1, 0.94, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return (old_blocks, new_blocks, ratio)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "label": "NormalizeBlocks", "type": "function", "loc": [600, 657], "level": 0, "parent": null, "vector": [2, 0, 0.903, 0.0833, 0, 0.66, 0.963, 664, 0, 2, 1, 0, 0, 0, 6], "semantic": {"name": "NormalizeBlocks", "arg_names": ["blocks", "line"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def NormalizeBlocks(blocks, line):\n \"\"\"Normalizes block representation of an intra line diff.\n\n One diff can have multiple representations. Some times the diff returned by\n the difflib for similar text sections is different even within same region.\n For example if 2 already indented lines were indented with one additional\n space character, the difflib may return the non matching space character to\n be any of the already existing spaces. So one line may show non matching"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L601_C2", "label": "expression", "type": "expression", "loc": [601, 636], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [8, 1, 0.8886, 0.0517, 1, 0.57, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Normalizes block representation of an intra line diff.\n\n One diff can have multiple representations. Some times the diff returned by\n the difflib for similar text sections is different even within same region.\n For example if 2 already indented lines were indented with one additional\n space character, the difflib may return the non matching space character to\n be any of the already existing spaces. So one line may show non matching\n space character as the first space character and the second line may show it"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L637_C2", "label": "result =", "type": "assigned_variable", "loc": [637, 637], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [14, 1, 0.9152, 0.0014, 1, 0.57, 0.2, 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_1183:Assign_L638_C2", "label": "prev_start, prev_len =", "type": "assigned_variable", "loc": [638, 638], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [14, 1, 0.9167, 0.0014, 1, 0.57, 0.4, 824, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "prev_start, prev_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_start, prev_len = blocks[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "label": "for curr_start, curr_len", "type": "for", "loc": [639, 654], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [6, 1, 0.9289, 0.023, 1, 0.57, 0.6, 560, 6, 0, 0, 0, 0, 0, 3], "semantic": {"name": "curr_start, curr_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for curr_start, curr_len in blocks[1:]:\n # Note: nm_ is a prefix for non matching and m_ is a prefix for matching.\n m_len, nm_len = prev_len, curr_start - (prev_start+prev_len)\n # This if condition checks if matching and non matching parts are greater\n # than zero length and are comprised of spaces ONLY. The last condition\n # deals with most of the observed cases of strange diffs.\n # Note: curr_start - prev_start == m_l + nm_l\n # So line[prev_start:curr_start] == matching_part + non_matching_part."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L641_C4", "label": "m_len, nm_len =", "type": "assigned_variable", "loc": [641, 641], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "vector": [14, 2, 0.921, 0.0014, 2, 0.31, 0.0, 76, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "m_len, nm_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " m_len, nm_len = prev_len, curr_start - (prev_start+prev_len)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L647_C4", "label": "text =", "type": "assigned_variable", "loc": [647, 647], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "vector": [14, 2, 0.9296, 0.0014, 2, 0.31, 0.3333, 439, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " text = line[prev_start:curr_start]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4", "label": "if", "type": "if", "loc": [648, 653], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "vector": [4, 2, 0.9346, 0.0086, 2, 0.31, 0.6667, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m_len > 0 and nm_len > 0 and text == ' ' * len(text):\n # Move the matching block towards the end i.e. normalize.\n result.append((prev_start + nm_len, m_len))\n else:\n # Keep the existing matching block.\n result.append((prev_start, prev_len))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L650_C6", "label": "append()", "type": "expression", "loc": [650, 650], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4", "vector": [8, 3, 0.9339, 0.0014, 3, 0.97, 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((prev_start + nm_len, m_len))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L653_C6", "label": "append()", "type": "expression", "loc": [653, 653], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4", "vector": [8, 3, 0.9382, 0.0014, 3, 0.97, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append((prev_start, prev_len))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L654_C4", "label": "prev_start, prev_len =", "type": "assigned_variable", "loc": [654, 654], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "vector": [14, 2, 0.9397, 0.0014, 2, 0.31, 1.0, 824, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "prev_start, prev_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prev_start, prev_len = curr_start, curr_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L655_C2", "label": "append()", "type": "expression", "loc": [655, 655], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [8, 1, 0.9411, 0.0014, 1, 0.57, 0.8, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(blocks[-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L657_C2", "label": "return", "type": "return", "loc": [657, 657], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "vector": [13, 1, 0.944, 0.0014, 1, 0.57, 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_1183:FunctionDef_L660_C0", "label": "RenderIntraRegionDiff", "type": "function", "loc": [660, 696], "level": 0, "parent": null, "vector": [2, 0, 0.9741, 0.0532, 0, 0.66, 1.0, 246, 0, 9, 1, 0, 0, 0, 7], "semantic": {"name": "RenderIntraRegionDiff", "arg_names": ["lines", "diff_blocks", "tag", "ratio", "limit", "indent", "tabsize", "mark_tabs", "dbg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RenderIntraRegionDiff(lines, diff_blocks, tag, ratio, limit=80, indent=5,\n tabsize=8, mark_tabs=False, dbg=False):\n \"\"\"Renders intra region diff for one side.\n\n Args:\n lines: list of strings representing source code in the region\n diff_blocks: blocks that were returned for this region by IntraRegionDiff()\n tag: 'new' or 'old'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L662_C2", "label": "expression", "type": "expression", "loc": [662, 678], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [8, 1, 0.9626, 0.0244, 1, 0.06, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Renders intra region diff for one side.\n\n Args:\n lines: list of strings representing source code in the region\n diff_blocks: blocks that were returned for this region by IntraRegionDiff()\n tag: 'new' or 'old'\n ratio: similarity ratio returned by the diff computing function\n limit: folding limit"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L679_C2", "label": "result =", "type": "assigned_variable", "loc": [679, 679], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [14, 1, 0.9756, 0.0014, 1, 0.06, 0.2, 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_1183:Assign_L680_C2", "label": "dbg_info =", "type": "assigned_variable", "loc": [680, 680], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [14, 1, 0.977, 0.0014, 1, 0.06, 0.4, 139, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "dbg_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbg_info = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L681_C2", "label": "if", "type": "if", "loc": [681, 682], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [4, 1, 0.9792, 0.0029, 1, 0.06, 0.6, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if dbg:\n dbg_info = 'Ratio: %.1f' % ratio"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L682_C4", "label": "dbg_info =", "type": "assigned_variable", "loc": [682, 682], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L681_C2", "vector": [14, 2, 0.9799, 0.0014, 2, 0.66, 0.0, 139, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dbg_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dbg_info = 'Ratio: %.1f' % ratio"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "label": "for line, blocks", "type": "for", "loc": [683, 694], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [6, 1, 0.9892, 0.0172, 1, 0.06, 0.8, 152, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "line, blocks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line, blocks in zip(lines, diff_blocks):\n blocks = NormalizeBlocks(blocks, line)\n blocks = CompactBlocks(blocks)\n diff = RenderIntraLineDiff(blocks,\n line,\n tag,\n dbg_info=dbg_info,\n limit=limit,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L684_C4", "label": "blocks = NormalizeBlocks()", "type": "assigned_variable", "loc": [684, 684], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "vector": [14, 2, 0.9828, 0.0014, 2, 0.88, 0.0, 384, 3, 2, 0, 0, 664, 10, 1], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "NormalizeBlocks", "annotation": ""}, "snippet": " blocks = NormalizeBlocks(blocks, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L685_C4", "label": "blocks = CompactBlocks()", "type": "assigned_variable", "loc": [685, 685], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "vector": [14, 2, 0.9842, 0.0014, 2, 0.88, 0.3333, 384, 3, 1, 0, 0, 8, 10, 1], "semantic": {"name": "blocks", "arg_names": [], "import_names": [], "rhs_call_name": "CompactBlocks", "annotation": ""}, "snippet": " blocks = CompactBlocks(blocks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L686_C4", "label": "diff = RenderIntraLineDiff()", "type": "assigned_variable", "loc": [686, 693], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "vector": [14, 2, 0.9907, 0.0115, 2, 0.88, 0.6667, 833, 3, 8, 0, 0, 875, 10, 1], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "RenderIntraLineDiff", "annotation": ""}, "snippet": " diff = RenderIntraLineDiff(blocks,\n line,\n tag,\n dbg_info=dbg_info,\n limit=limit,\n indent=indent,\n tabsize=tabsize,\n mark_tabs=mark_tabs)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L694_C4", "label": "append()", "type": "expression", "loc": [694, 694], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "vector": [8, 2, 0.9971, 0.0014, 2, 0.88, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " result.append(diff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L696_C2", "label": "return", "type": "return", "loc": [696, 696], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "vector": [13, 1, 1.0, 0.0014, 1, 0.06, 1.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_1183:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L105_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L108_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L110_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L113_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L112_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L115_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L106_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L117_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L92_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L118_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L145_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L145_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L146_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L147_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L147_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L154_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L157_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L159_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:While_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L160_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L162_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L156_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L166_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L167_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L168_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L121_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L169_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L173_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L190_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L191_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L195_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L197_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L172_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L203_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L215_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L202_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L217_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L221_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L220_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L240_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L244_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L260_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L243_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L262_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L266_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L280_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L281_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L283_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L283_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L287_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:Try_L287_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L288_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L292_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L293_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L294_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L295_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L296_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L304_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L304_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L305_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L310_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L311_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L312_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L312_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L313_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L315_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L316_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L317_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L317_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L318_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L320_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L321_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L323_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L325_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L326_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L327_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L324_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L328_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L330_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L335_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L265_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L337_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L341_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L354_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L355_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L356_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L340_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L358_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L362_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L361_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L371_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L372_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L377_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L395_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L396_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L397_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L398_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L399_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L402_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L414_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L414_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L415_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L401_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L416_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L375_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L417_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L422_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L438_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L442_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L442_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L443_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L444_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L450_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L451_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L452_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L453_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L453_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L454_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L457_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L457_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L458_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L420_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L459_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L463_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L474_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L475_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L476_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L477_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L478_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L462_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L480_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L484_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L502_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L503_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L504_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L504_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L507_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L510_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L483_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L512_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L516_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L534_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L534_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L535_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L536_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L515_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L538_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L539_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L542_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L545_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L540_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L546_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L537_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L548_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L552_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L561_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L562_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L564_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L568_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L569_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L563_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L570_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L551_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L571_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L575_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L586_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L587_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L588_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L589_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L589_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L590_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L591_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L593_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L593_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L594_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L595_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L574_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L597_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L601_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L637_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L638_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L641_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L647_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L650_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L648_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L653_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L639_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L654_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L655_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L600_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L657_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L662_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L679_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L680_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L681_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:If_L681_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L682_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L684_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L685_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Assign_L686_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:For_L683_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Expr_L694_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1183:FunctionDef_L660_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1183:Return_L696_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Utility to read and apply a unified diff without forking patch(1).
For a discussion of the unified diff format, see my blog on Artima:
http://www.artima.com/weblogs/viewpost.jsp?thread=164293
"""
import difflib
import logging
import re
import sys
_CHUNK_RE = re.compile(r"""
@@
\s+
-
(?: (\d+) (?: , (\d+) )?)
\s+
\+
(?: (\d+) (?: , (\d+) )?)
\s+
@@
""", re.VERBOSE)
def PatchLines(old_lines, patch_lines, name="<patch>"):
"""Patches the old_lines with patches read from patch_lines.
This only reads unified diffs. The header lines are ignored.
Yields (tag, old, new) tuples where old and new are lists of lines.
The tag can either start with "error" or be a tag from difflib: "equal",
"insert", "delete", "replace". After "error" is yielded, no more
tuples are yielded. It is possible that consecutive "equal" tuples
are yielded.
"""
chunks = ParsePatchToChunks(patch_lines, name)
if chunks is None:
return iter([("error: ParsePatchToChunks failed", [], [])])
return PatchChunks(old_lines, chunks)
def PatchChunks(old_lines, chunks):
"""Patche old_lines with chunks.
Yields (tag, old, new) tuples where old and new are lists of lines.
The tag can either start with "error" or be a tag from difflib: "equal",
"insert", "delete", "replace". After "error" is yielded, no more
tuples are yielded. It is possible that consecutive "equal" tuples
are yielded.
"""
if not chunks:
# The patch is a no-op
yield ("equal", old_lines, old_lines)
return
old_pos = 0
for (old_i, old_j), _, old_chunk, new_chunk in chunks:
eq = old_lines[old_pos:old_i]
if eq:
yield "equal", eq, eq
old_pos = old_i
# Check that the patch matches the target file
if old_lines[old_i:old_j] != old_chunk:
logging.warn("mismatch:%s.%s.", old_lines[old_i:old_j], old_chunk)
yield ("error: old chunk mismatch", old_lines[old_i:old_j], old_chunk)
return
# TODO(guido): ParsePatch knows the diff details, but throws the info away
sm = difflib.SequenceMatcher(None, old_chunk, new_chunk)
for tag, i1, i2, j1, j2 in sm.get_opcodes():
yield tag, old_chunk[i1:i2], new_chunk[j1:j2]
old_pos = old_j
# Copy the final matching chunk if any.
eq = old_lines[old_pos:]
if eq:
yield ("equal", eq, eq)
def ParseRevision(lines):
"""Parse the revision number out of the raw lines of the patch.
Returns 0 (new file) if no revision number was found.
"""
for line in lines[:10]:
if line.startswith('@'):
break
m = re.match(r'---\s.*\(.*\s(\d+)\)\s*$', line)
if m:
return int(m.group(1))
return 0
_NO_NEWLINE_MESSAGE = "\\ No newline at end of file"
def ParsePatchToChunks(lines, name="<patch>"):
"""Parses a patch from a list of lines.
Return a list of chunks, where each chunk is a tuple:
old_range, new_range, old_lines, new_lines
Returns a list of chunks (possibly empty); or None if there's a problem.
"""
lineno = 0
raw_chunk = []
chunks = []
old_range = new_range = None
old_last = new_last = 0
in_prelude = True
for line in lines:
lineno += 1
if in_prelude:
# Skip leading lines until after we've seen one starting with '+++'
if line.startswith("+++"):
in_prelude = False
continue
match = _CHUNK_RE.match(line)
if match:
if raw_chunk:
# Process the lines in the previous chunk
old_chunk = []
new_chunk = []
for tag, rest in raw_chunk:
if tag in (" ", "-"):
old_chunk.append(rest)
if tag in (" ", "+"):
new_chunk.append(rest)
# Check consistency
old_i, old_j = old_range
new_i, new_j = new_range
if len(old_chunk) != old_j - old_i or len(new_chunk) != new_j - new_i:
logging.warn("%s:%s: previous chunk has incorrect length",
name, lineno)
return None
chunks.append((old_range, new_range, old_chunk, new_chunk))
raw_chunk = []
# Parse the @@ header
old_ln, old_n, new_ln, new_n = match.groups()
old_ln, old_n, new_ln, new_n = map(long,
(old_ln, old_n or 1,
new_ln, new_n or 1))
# Convert the numbers to list indices we can use
if old_n == 0:
old_i = old_ln
else:
old_i = old_ln - 1
old_j = old_i + old_n
old_range = old_i, old_j
if new_n == 0:
new_i = new_ln
else:
new_i = new_ln - 1
new_j = new_i + new_n
new_range = new_i, new_j
# Check header consistency with previous header
if old_i < old_last or new_i < new_last:
logging.warn("%s:%s: chunk header out of order: %r",
name, lineno, line)
return None
if old_i - old_last != new_i - new_last:
logging.warn("%s:%s: inconsistent chunk header: %r",
name, lineno, line)
return None
old_last = old_j
new_last = new_j
else:
tag, rest = line[0], line[1:]
if tag in (" ", "-", "+"):
raw_chunk.append((tag, rest))
elif line.startswith(_NO_NEWLINE_MESSAGE):
# TODO(guido): need to check that no more lines follow for this file
if raw_chunk:
last_tag, last_rest = raw_chunk[-1]
if last_rest.endswith("\n"):
raw_chunk[-1] = (last_tag, last_rest[:-1])
else:
# Only log if it's a non-blank line. Blank lines we see a lot.
if line and line.strip():
logging.warn("%s:%d: indecypherable input: %r", name, lineno, line)
if chunks or raw_chunk:
break # Trailing garbage isn't so bad
return None
if raw_chunk:
# Process the lines in the last chunk
old_chunk = []
new_chunk = []
for tag, rest in raw_chunk:
if tag in (" ", "-"):
old_chunk.append(rest)
if tag in (" ", "+"):
new_chunk.append(rest)
# Check consistency
old_i, old_j = old_range
new_i, new_j = new_range
if len(old_chunk) != old_j - old_i or len(new_chunk) != new_j - new_i:
print >> sys.stderr, ("%s:%s: last chunk has incorrect length" %
(name, lineno))
return None
chunks.append((old_range, new_range, old_chunk, new_chunk))
raw_chunk = []
return chunks
def ParsePatchToLines(lines):
"""Parses a patch from a list of lines.
Returns None on error, otherwise a list of 3-tuples:
(old_line_no, new_line_no, line)
A line number can be 0 if it doesn't exist in the old/new file.
"""
# TODO: can we share some of this code with ParsePatchToChunks?
result = []
in_prelude = True
for line in lines:
if in_prelude:
result.append((0, 0, line))
# Skip leading lines until after we've seen one starting with '+++'
if line.startswith("+++"):
in_prelude = False
elif line.startswith("@"):
result.append((0, 0, line))
match = _CHUNK_RE.match(line)
if not match:
logging.warn("ParsePatchToLines match failed on %s", line)
return None
old_ln = int(match.groups()[0])
new_ln = int(match.groups()[2])
else:
if line[0] == "-":
result.append((old_ln, 0, line))
old_ln += 1
elif line[0] == "+":
result.append((0, new_ln, line))
new_ln += 1
elif line[0] == " ":
result.append((old_ln, new_ln, line))
old_ln += 1
new_ln += 1
elif line.startswith(_NO_NEWLINE_MESSAGE):
continue
else: # Something else, could be property changes etc.
result.append((0, 0, line))
return result
| ajibawa-2023/Python-Code-Large/train/row_1184 | 146 | 259 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 19], "level": 0, "parent": null, "vector": [8, 0, 0.0656, 0.0193, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Utility to read and apply a unified diff without forking patch(1).\n\nFor a discussion of the unified diff format, see my blog on Artima:\nhttp://www.artima.com/weblogs/viewpost.jsp?thread=164293\n\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Import_L21_C0", "label": "difflib import difflib", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0811, 0.0039, 0, 0.66, 0.0909, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "difflib", "arg_names": [], "import_names": ["difflib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import difflib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Import_L22_C0", "label": "logging import logging", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0849, 0.0039, 0, 0.66, 0.1818, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Import_L23_C0", "label": "re import re", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0888, 0.0039, 0, 0.66, 0.2727, 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_1184:Import_L24_C0", "label": "sys import sys", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0927, 0.0039, 0, 0.66, 0.3636, 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_1184:Assign_L27_C0", "label": "_CHUNK_RE = compile()", "type": "assigned_variable", "loc": [27, 37], "level": 0, "parent": null, "vector": [14, 0, 0.1236, 0.0425, 0, 0.66, 0.4545, 53, 3, 2, 0, 0, 821, 10, 1], "semantic": {"name": "_CHUNK_RE", "arg_names": [], "import_names": [], "rhs_call_name": "compile", "annotation": ""}, "snippet": "_CHUNK_RE = re.compile(r\"\"\"\n @@\n \\s+\n -\n (?: (\\d+) (?: , (\\d+) )?)\n \\s+\n \\+\n (?: (\\d+) (?: , (\\d+) )?)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "label": "PatchLines", "type": "function", "loc": [40, 53], "level": 0, "parent": null, "vector": [2, 0, 0.1795, 0.0541, 0, 0.66, 0.5455, 605, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "PatchLines", "arg_names": ["old_lines", "patch_lines", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PatchLines(old_lines, patch_lines, name=\"<patch>\"):\n \"\"\"Patches the old_lines with patches read from patch_lines.\n\n This only reads unified diffs. The header lines are ignored.\n Yields (tag, old, new) tuples where old and new are lists of lines.\n The tag can either start with \"error\" or be a tag from difflib: \"equal\",\n \"insert\", \"delete\", \"replace\". After \"error\" is yielded, no more\n tuples are yielded. It is possible that consecutive \"equal\" tuples"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L41_C2", "label": "expression", "type": "expression", "loc": [41, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "vector": [8, 1, 0.1737, 0.0347, 1, 0.97, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Patches the old_lines with patches read from patch_lines.\n\n This only reads unified diffs. The header lines are ignored.\n Yields (tag, old, new) tuples where old and new are lists of lines.\n The tag can either start with \"error\" or be a tag from difflib: \"equal\",\n \"insert\", \"delete\", \"replace\". After \"error\" is yielded, no more\n tuples are yielded. It is possible that consecutive \"equal\" tuples\n are yielded."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L50_C2", "label": "chunks = ParsePatchToChunks()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "vector": [14, 1, 0.1931, 0.0039, 1, 0.97, 0.3333, 284, 3, 2, 0, 0, 491, 10, 1], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "ParsePatchToChunks", "annotation": ""}, "snippet": " chunks = ParsePatchToChunks(patch_lines, name)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L51_C2", "label": "if", "type": "if", "loc": [51, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "vector": [4, 1, 0.1988, 0.0077, 1, 0.97, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if chunks is None:\n return iter([(\"error: ParsePatchToChunks failed\", [], [])])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L52_C4", "label": "return", "type": "return", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L51_C2", "vector": [13, 2, 0.2008, 0.0039, 2, 0.24, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return iter([(\"error: ParsePatchToChunks failed\", [], [])])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L53_C2", "label": "return", "type": "return", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "vector": [13, 1, 0.2046, 0.0039, 1, 0.97, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return PatchChunks(old_lines, chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "label": "PatchChunks", "type": "function", "loc": [56, 90], "level": 0, "parent": null, "vector": [2, 0, 0.2819, 0.1351, 0, 0.66, 0.6364, 321, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "PatchChunks", "arg_names": ["old_lines", "chunks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def PatchChunks(old_lines, chunks):\n \"\"\"Patche old_lines with chunks.\n\n Yields (tag, old, new) tuples where old and new are lists of lines.\n The tag can either start with \"error\" or be a tag from difflib: \"equal\",\n \"insert\", \"delete\", \"replace\". After \"error\" is yielded, no more\n tuples are yielded. It is possible that consecutive \"equal\" tuples\n are yielded."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L57_C2", "label": "expression", "type": "expression", "loc": [57, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [8, 1, 0.2336, 0.0309, 1, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Patche old_lines with chunks.\n\n Yields (tag, old, new) tuples where old and new are lists of lines.\n The tag can either start with \"error\" or be a tag from difflib: \"equal\",\n \"insert\", \"delete\", \"replace\". After \"error\" is yielded, no more\n tuples are yielded. It is possible that consecutive \"equal\" tuples\n are yielded.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2", "label": "if", "type": "if", "loc": [65, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [4, 1, 0.2568, 0.0154, 1, 0.0, 0.2, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not chunks:\n # The patch is a no-op\n yield (\"equal\", old_lines, old_lines)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L67_C4", "label": "expression", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2", "vector": [8, 2, 0.2587, 0.0039, 2, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield (\"equal\", old_lines, old_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L68_C4", "label": "return", "type": "return", "loc": [68, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2", "vector": [13, 2, 0.2625, 0.0039, 2, 0.6, 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_1184:Assign_L70_C2", "label": "old_pos =", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [14, 1, 0.2703, 0.0039, 1, 0.0, 0.4, 143, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "old_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_pos = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "label": "for _, old_chunk, new_chunk", "type": "for", "loc": [71, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [6, 1, 0.3012, 0.0579, 1, 0.0, 0.6, 855, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "_, old_chunk, new_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (old_i, old_j), _, old_chunk, new_chunk in chunks:\n eq = old_lines[old_pos:old_i]\n if eq:\n yield \"equal\", eq, eq\n old_pos = old_i\n # Check that the patch matches the target file\n if old_lines[old_i:old_j] != old_chunk:\n logging.warn(\"mismatch:%s.%s.\", old_lines[old_i:old_j], old_chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L72_C4", "label": "eq =", "type": "assigned_variable", "loc": [72, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [14, 2, 0.278, 0.0039, 2, 0.37, 0.0, 500, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "eq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eq = old_lines[old_pos:old_i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L73_C4", "label": "if", "type": "if", "loc": [73, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [4, 2, 0.2838, 0.0077, 2, 0.37, 0.1667, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if eq:\n yield \"equal\", eq, eq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L74_C6", "label": "expression", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L73_C4", "vector": [8, 3, 0.2857, 0.0039, 3, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield \"equal\", eq, eq"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L75_C4", "label": "old_pos =", "type": "assigned_variable", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [14, 2, 0.2896, 0.0039, 2, 0.37, 0.3333, 143, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_pos = old_i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "label": "if", "type": "if", "loc": [77, 80], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [4, 2, 0.3031, 0.0154, 2, 0.37, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_lines[old_i:old_j] != old_chunk:\n logging.warn(\"mismatch:%s.%s.\", old_lines[old_i:old_j], old_chunk)\n yield (\"error: old chunk mismatch\", old_lines[old_i:old_j], old_chunk)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L78_C6", "label": "warn()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "vector": [8, 3, 0.3012, 0.0039, 3, 0.94, 0.0, 960, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"mismatch:%s.%s.\", old_lines[old_i:old_j], old_chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L79_C6", "label": "expression", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "vector": [8, 3, 0.305, 0.0039, 3, 0.94, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield (\"error: old chunk mismatch\", old_lines[old_i:old_j], old_chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L80_C6", "label": "return", "type": "return", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "vector": [13, 3, 0.3089, 0.0039, 3, 0.94, 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_1184:Assign_L82_C4", "label": "sm = SequenceMatcher()", "type": "assigned_variable", "loc": [82, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [14, 2, 0.3166, 0.0039, 2, 0.37, 0.6667, 21, 3, 3, 0, 0, 54, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "SequenceMatcher", "annotation": ""}, "snippet": " sm = difflib.SequenceMatcher(None, old_chunk, new_chunk)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L83_C4", "label": "for tag, i1, i2, j1, j2", "type": "for", "loc": [83, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [6, 2, 0.3224, 0.0077, 2, 0.37, 0.8333, 429, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tag, i1, i2, j1, j2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, i1, i2, j1, j2 in sm.get_opcodes():\n yield tag, old_chunk[i1:i2], new_chunk[j1:j2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L84_C6", "label": "expression", "type": "expression", "loc": [84, 84], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L83_C4", "vector": [8, 3, 0.3243, 0.0039, 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 tag, old_chunk[i1:i2], new_chunk[j1:j2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L85_C4", "label": "old_pos =", "type": "assigned_variable", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "vector": [14, 2, 0.3282, 0.0039, 2, 0.37, 1.0, 143, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_pos", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_pos = old_j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L88_C2", "label": "eq =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [14, 1, 0.3398, 0.0039, 1, 0.0, 0.8, 500, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "eq", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " eq = old_lines[old_pos:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L89_C2", "label": "if", "type": "if", "loc": [89, 90], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "vector": [4, 1, 0.3456, 0.0077, 1, 0.0, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if eq:\n yield (\"equal\", eq, eq)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L90_C4", "label": "expression", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L89_C2", "vector": [8, 2, 0.3475, 0.0039, 2, 0.59, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield (\"equal\", eq, eq)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "label": "ParseRevision", "type": "function", "loc": [93, 104], "level": 0, "parent": null, "vector": [2, 0, 0.3803, 0.0463, 0, 0.66, 0.7273, 558, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "ParseRevision", "arg_names": ["lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ParseRevision(lines):\n \"\"\"Parse the revision number out of the raw lines of the patch.\n\n Returns 0 (new file) if no revision number was found.\n \"\"\"\n for line in lines[:10]:\n if line.startswith('@'):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L94_C2", "label": "expression", "type": "expression", "loc": [94, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "vector": [8, 1, 0.3687, 0.0154, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parse the revision number out of the raw lines of the patch.\n\n Returns 0 (new file) if no revision number was found.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "label": "for line", "type": "for", "loc": [98, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "vector": [6, 1, 0.388, 0.0232, 1, 0.34, 0.5, 373, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in lines[:10]:\n if line.startswith('@'):\n break\n m = re.match(r'---\\s.*\\(.*\\s(\\d+)\\)\\s*$', line)\n if m:\n return int(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L99_C4", "label": "if", "type": "if", "loc": [99, 100], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "vector": [4, 2, 0.3842, 0.0077, 2, 0.01, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('@'):\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L101_C4", "label": "m = match()", "type": "assigned_variable", "loc": [101, 101], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "vector": [14, 2, 0.39, 0.0039, 2, 0.01, 0.5, 711, 3, 2, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = re.match(r'---\\s.*\\(.*\\s(\\d+)\\)\\s*$', line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L102_C4", "label": "if", "type": "if", "loc": [102, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "vector": [4, 2, 0.3958, 0.0077, 2, 0.01, 1.0, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n return int(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L103_C6", "label": "return", "type": "return", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L102_C4", "vector": [13, 3, 0.3977, 0.0039, 3, 0.35, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return int(m.group(1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L104_C2", "label": "return", "type": "return", "loc": [104, 104], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "vector": [13, 1, 0.4015, 0.0039, 1, 0.34, 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_1184:Assign_L107_C0", "label": "_NO_NEWLINE_MESSAGE =", "type": "assigned_variable", "loc": [107, 107], "level": 0, "parent": null, "vector": [14, 0, 0.4131, 0.0039, 0, 0.66, 0.8182, 810, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "_NO_NEWLINE_MESSAGE", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "_NO_NEWLINE_MESSAGE = \"\\\\ No newline at end of file\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "label": "ParsePatchToChunks", "type": "function", "loc": [110, 216], "level": 0, "parent": null, "vector": [2, 0, 0.6293, 0.4131, 0, 0.66, 0.9091, 491, 0, 2, 1, 0, 0, 0, 22], "semantic": {"name": "ParsePatchToChunks", "arg_names": ["lines", "name"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ParsePatchToChunks(lines, name=\"<patch>\"):\n \"\"\"Parses a patch from a list of lines.\n\n Return a list of chunks, where each chunk is a tuple:\n\n old_range, new_range, old_lines, new_lines\n\n Returns a list of chunks (possibly empty); or None if there's a problem."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L111_C2", "label": "expression", "type": "expression", "loc": [111, 118], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [8, 1, 0.4421, 0.0309, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a patch from a list of lines.\n\n Return a list of chunks, where each chunk is a tuple:\n\n old_range, new_range, old_lines, new_lines\n\n Returns a list of chunks (possibly empty); or None if there's a problem.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L119_C2", "label": "lineno =", "type": "assigned_variable", "loc": [119, 119], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.4595, 0.0039, 1, 0.19, 0.1111, 48, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lineno = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L120_C2", "label": "raw_chunk =", "type": "assigned_variable", "loc": [120, 120], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.4633, 0.0039, 1, 0.19, 0.2222, 6, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "raw_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " raw_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L121_C2", "label": "chunks =", "type": "assigned_variable", "loc": [121, 121], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.4672, 0.0039, 1, 0.19, 0.3333, 284, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "chunks", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " chunks = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L122_C2", "label": "old_range =", "type": "assigned_variable", "loc": [122, 122], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.471, 0.0039, 1, 0.19, 0.4444, 204, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "old_range", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_range = new_range = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L123_C2", "label": "old_last =", "type": "assigned_variable", "loc": [123, 123], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.4749, 0.0039, 1, 0.19, 0.5556, 815, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "old_last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_last = new_last = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L124_C2", "label": "in_prelude =", "type": "assigned_variable", "loc": [124, 124], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [14, 1, 0.4788, 0.0039, 1, 0.19, 0.6667, 59, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "in_prelude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_prelude = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "label": "for line", "type": "for", "loc": [125, 197], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [6, 1, 0.6216, 0.2819, 1, 0.19, 0.7778, 373, 2, 0, 0, 0, 0, 0, 17], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in lines:\n lineno += 1\n if in_prelude:\n # Skip leading lines until after we've seen one starting with '+++'\n if line.startswith(\"+++\"):\n in_prelude = False\n continue\n match = _CHUNK_RE.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L127_C4", "label": "if", "type": "if", "loc": [127, 131], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "vector": [4, 2, 0.4981, 0.0193, 2, 0.68, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_prelude:\n # Skip leading lines until after we've seen one starting with '+++'\n if line.startswith(\"+++\"):\n in_prelude = False\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L129_C6", "label": "if", "type": "if", "loc": [129, 130], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L127_C4", "vector": [4, 3, 0.5, 0.0077, 3, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith(\"+++\"):\n in_prelude = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L130_C8", "label": "in_prelude =", "type": "assigned_variable", "loc": [130, 130], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L129_C6", "vector": [14, 4, 0.5019, 0.0039, 4, 0.56, 0.0, 59, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "in_prelude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_prelude = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L132_C4", "label": "match = match()", "type": "assigned_variable", "loc": [132, 132], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "vector": [14, 2, 0.5097, 0.0039, 2, 0.68, 0.5, 36, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match = _CHUNK_RE.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "label": "if", "type": "if", "loc": [133, 197], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "vector": [4, 2, 0.6371, 0.251, 2, 0.68, 1.0, 0, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if match:\n if raw_chunk:\n # Process the lines in the previous chunk\n old_chunk = []\n new_chunk = []\n for tag, rest in raw_chunk:\n if tag in (\" \", \"-\"):\n old_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "label": "if", "type": "if", "loc": [134, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.5502, 0.0695, 3, 0.86, 0.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if raw_chunk:\n # Process the lines in the previous chunk\n old_chunk = []\n new_chunk = []\n for tag, rest in raw_chunk:\n if tag in (\" \", \"-\"):\n old_chunk.append(rest)\n if tag in (\" \", \"+\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L136_C8", "label": "old_chunk =", "type": "assigned_variable", "loc": [136, 136], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [14, 4, 0.5251, 0.0039, 4, 0.51, 0.0, 732, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "old_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L137_C8", "label": "new_chunk =", "type": "assigned_variable", "loc": [137, 137], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [14, 4, 0.529, 0.0039, 4, 0.51, 0.1429, 147, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8", "label": "for tag, rest", "type": "for", "loc": [138, 142], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [6, 4, 0.5405, 0.0193, 4, 0.51, 0.2857, 280, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag, rest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, rest in raw_chunk:\n if tag in (\" \", \"-\"):\n old_chunk.append(rest)\n if tag in (\" \", \"+\"):\n new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L139_C10", "label": "if", "type": "if", "loc": [139, 140], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8", "vector": [4, 5, 0.5386, 0.0077, 5, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in (\" \", \"-\"):\n old_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L140_C12", "label": "append()", "type": "expression", "loc": [140, 140], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L139_C10", "vector": [8, 6, 0.5405, 0.0039, 6, 0.01, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " old_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L141_C10", "label": "if", "type": "if", "loc": [141, 142], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8", "vector": [4, 5, 0.5463, 0.0077, 5, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in (\" \", \"+\"):\n new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L142_C12", "label": "append()", "type": "expression", "loc": [142, 142], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L141_C10", "vector": [8, 6, 0.5483, 0.0039, 6, 0.75, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L144_C8", "label": "old_i, old_j =", "type": "assigned_variable", "loc": [144, 144], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [14, 4, 0.556, 0.0039, 4, 0.51, 0.4286, 513, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_i, old_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_i, old_j = old_range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L145_C8", "label": "new_i, new_j =", "type": "assigned_variable", "loc": [145, 145], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [14, 4, 0.5598, 0.0039, 4, 0.51, 0.5714, 870, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_i, new_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_i, new_j = new_range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8", "label": "if", "type": "if", "loc": [146, 149], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [4, 4, 0.5695, 0.0154, 4, 0.51, 0.7143, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(old_chunk) != old_j - old_i or len(new_chunk) != new_j - new_i:\n logging.warn(\"%s:%s: previous chunk has incorrect length\",\n name, lineno)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L147_C10", "label": "warn()", "type": "expression", "loc": [147, 148], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8", "vector": [8, 5, 0.5695, 0.0077, 5, 0.87, 0.0, 960, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"%s:%s: previous chunk has incorrect length\",\n name, lineno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L149_C10", "label": "return", "type": "return", "loc": [149, 149], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8", "vector": [13, 5, 0.5753, 0.0039, 5, 0.87, 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_1184:Expr_L150_C8", "label": "append()", "type": "expression", "loc": [150, 150], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [8, 4, 0.5792, 0.0039, 4, 0.51, 0.8571, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " chunks.append((old_range, new_range, old_chunk, new_chunk))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L151_C8", "label": "raw_chunk =", "type": "assigned_variable", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "vector": [14, 4, 0.583, 0.0039, 4, 0.51, 1.0, 6, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "raw_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " raw_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L153_C6", "label": "old_ln, old_n, new_ln, new_n = groups()", "type": "assigned_variable", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.5907, 0.0039, 3, 0.86, 0.0714, 193, 3, 0, 0, 0, 161, 10, 1], "semantic": {"name": "old_ln, old_n, new_ln, new_n", "arg_names": [], "import_names": [], "rhs_call_name": "groups", "annotation": ""}, "snippet": " old_ln, old_n, new_ln, new_n = match.groups()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L154_C6", "label": "old_ln, old_n, new_ln, new_n = map()", "type": "assigned_variable", "loc": [154, 156], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.5985, 0.0116, 3, 0.86, 0.1429, 193, 3, 2, 0, 0, 53, 10, 1], "semantic": {"name": "old_ln, old_n, new_ln, new_n", "arg_names": [], "import_names": [], "rhs_call_name": "map", "annotation": ""}, "snippet": " old_ln, old_n, new_ln, new_n = map(long,\n (old_ln, old_n or 1,\n new_ln, new_n or 1))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6", "label": "if", "type": "if", "loc": [158, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.6158, 0.0154, 3, 0.86, 0.2143, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_n == 0:\n old_i = old_ln\n else:\n old_i = old_ln - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L159_C8", "label": "old_i =", "type": "assigned_variable", "loc": [159, 159], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6", "vector": [14, 4, 0.6139, 0.0039, 4, 0.3, 0.0, 234, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_i = old_ln"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L161_C8", "label": "old_i =", "type": "assigned_variable", "loc": [161, 161], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6", "vector": [14, 4, 0.6216, 0.0039, 4, 0.3, 1.0, 234, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_i = old_ln - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L162_C6", "label": "old_j =", "type": "assigned_variable", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.6255, 0.0039, 3, 0.86, 0.2857, 808, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_j = old_i + old_n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L163_C6", "label": "old_range =", "type": "assigned_variable", "loc": [163, 163], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.6293, 0.0039, 3, 0.86, 0.3571, 204, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "old_range", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_range = old_i, old_j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6", "label": "if", "type": "if", "loc": [164, 167], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.639, 0.0154, 3, 0.86, 0.4286, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_n == 0:\n new_i = new_ln\n else:\n new_i = new_ln - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L165_C8", "label": "new_i =", "type": "assigned_variable", "loc": [165, 165], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6", "vector": [14, 4, 0.6371, 0.0039, 4, 0.58, 0.0, 438, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_i = new_ln"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L167_C8", "label": "new_i =", "type": "assigned_variable", "loc": [167, 167], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6", "vector": [14, 4, 0.6448, 0.0039, 4, 0.58, 1.0, 438, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_i = new_ln - 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L168_C6", "label": "new_j =", "type": "assigned_variable", "loc": [168, 168], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.6486, 0.0039, 3, 0.86, 0.5, 549, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_j = new_i + new_n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L169_C6", "label": "new_range =", "type": "assigned_variable", "loc": [169, 169], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.6525, 0.0039, 3, 0.86, 0.5714, 44, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "new_range", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_range = new_i, new_j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6", "label": "if", "type": "if", "loc": [171, 174], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.666, 0.0154, 3, 0.86, 0.6429, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_i < old_last or new_i < new_last:\n logging.warn(\"%s:%s: chunk header out of order: %r\",\n name, lineno, line)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L172_C8", "label": "warn()", "type": "expression", "loc": [172, 173], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6", "vector": [8, 4, 0.666, 0.0077, 4, 0.26, 0.0, 960, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"%s:%s: chunk header out of order: %r\",\n name, lineno, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L174_C8", "label": "return", "type": "return", "loc": [174, 174], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6", "vector": [13, 4, 0.6718, 0.0039, 4, 0.26, 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_1184:If_L175_C6", "label": "if", "type": "if", "loc": [175, 178], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.6815, 0.0154, 3, 0.86, 0.7143, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_i - old_last != new_i - new_last:\n logging.warn(\"%s:%s: inconsistent chunk header: %r\",\n name, lineno, line)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L176_C8", "label": "warn()", "type": "expression", "loc": [176, 177], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L175_C6", "vector": [8, 4, 0.6815, 0.0077, 4, 0.54, 0.0, 960, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"%s:%s: inconsistent chunk header: %r\",\n name, lineno, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L178_C8", "label": "return", "type": "return", "loc": [178, 178], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L175_C6", "vector": [13, 4, 0.6873, 0.0039, 4, 0.54, 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_1184:Assign_L179_C6", "label": "old_last =", "type": "assigned_variable", "loc": [179, 179], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.6911, 0.0039, 3, 0.86, 0.7857, 815, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_last = old_j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L180_C6", "label": "new_last =", "type": "assigned_variable", "loc": [180, 180], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.695, 0.0039, 3, 0.86, 0.8571, 721, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_last = new_j"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L182_C6", "label": "tag, rest =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [14, 3, 0.7027, 0.0039, 3, 0.86, 0.9286, 280, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "tag, rest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tag, rest = line[0], line[1:]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6", "label": "if", "type": "if", "loc": [183, 197], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "vector": [4, 3, 0.7336, 0.0579, 3, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in (\" \", \"-\", \"+\"):\n raw_chunk.append((tag, rest))\n elif line.startswith(_NO_NEWLINE_MESSAGE):\n # TODO(guido): need to check that no more lines follow for this file\n if raw_chunk:\n last_tag, last_rest = raw_chunk[-1]\n if last_rest.endswith(\"\\n\"):\n raw_chunk[-1] = (last_tag, last_rest[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L184_C8", "label": "append()", "type": "expression", "loc": [184, 184], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6", "vector": [8, 4, 0.7104, 0.0039, 4, 0.31, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " raw_chunk.append((tag, rest))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "label": "if", "type": "if", "loc": [185, 197], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6", "vector": [4, 4, 0.7375, 0.0502, 4, 0.31, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line.startswith(_NO_NEWLINE_MESSAGE):\n # TODO(guido): need to check that no more lines follow for this file\n if raw_chunk:\n last_tag, last_rest = raw_chunk[-1]\n if last_rest.endswith(\"\\n\"):\n raw_chunk[-1] = (last_tag, last_rest[:-1])\n else:\n # Only log if it's a non-blank line. Blank lines we see a lot."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8", "label": "if", "type": "if", "loc": [187, 190], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "vector": [4, 5, 0.7278, 0.0154, 5, 0.32, 0.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if raw_chunk:\n last_tag, last_rest = raw_chunk[-1]\n if last_rest.endswith(\"\\n\"):\n raw_chunk[-1] = (last_tag, last_rest[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L188_C10", "label": "last_tag, last_rest =", "type": "assigned_variable", "loc": [188, 188], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8", "vector": [14, 6, 0.7259, 0.0039, 6, 0.04, 0.0, 597, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last_tag, last_rest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_tag, last_rest = raw_chunk[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L189_C10", "label": "if", "type": "if", "loc": [189, 190], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8", "vector": [4, 6, 0.7317, 0.0077, 6, 0.04, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if last_rest.endswith(\"\\n\"):\n raw_chunk[-1] = (last_tag, last_rest[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L190_C12", "label": "assign", "type": "assigned_variable", "loc": [190, 190], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L189_C10", "vector": [14, 7, 0.7336, 0.0039, 7, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " raw_chunk[-1] = (last_tag, last_rest[:-1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L193_C8", "label": "if", "type": "if", "loc": [193, 194], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "vector": [4, 5, 0.7471, 0.0077, 5, 0.32, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line and line.strip():\n logging.warn(\"%s:%d: indecypherable input: %r\", name, lineno, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L194_C10", "label": "warn()", "type": "expression", "loc": [194, 194], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L193_C8", "vector": [8, 6, 0.749, 0.0039, 6, 0.1, 0.0, 960, 3, 4, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"%s:%d: indecypherable input: %r\", name, lineno, line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L195_C8", "label": "if", "type": "if", "loc": [195, 196], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "vector": [4, 5, 0.7548, 0.0077, 5, 0.32, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if chunks or raw_chunk:\n break # Trailing garbage isn't so bad"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L197_C8", "label": "return", "type": "return", "loc": [197, 197], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "vector": [13, 5, 0.7606, 0.0039, 5, 0.32, 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_1184:If_L198_C2", "label": "if", "type": "if", "loc": [198, 215], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [4, 1, 0.7973, 0.0695, 1, 0.19, 0.8889, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if raw_chunk:\n # Process the lines in the last chunk\n old_chunk = []\n new_chunk = []\n for tag, rest in raw_chunk:\n if tag in (\" \", \"-\"):\n old_chunk.append(rest)\n if tag in (\" \", \"+\"):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L200_C4", "label": "old_chunk =", "type": "assigned_variable", "loc": [200, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [14, 2, 0.7722, 0.0039, 2, 0.89, 0.0, 732, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "old_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L201_C4", "label": "new_chunk =", "type": "assigned_variable", "loc": [201, 201], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [14, 2, 0.7761, 0.0039, 2, 0.89, 0.1429, 147, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4", "label": "for tag, rest", "type": "for", "loc": [202, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [6, 2, 0.7876, 0.0193, 2, 0.89, 0.2857, 280, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag, rest", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, rest in raw_chunk:\n if tag in (\" \", \"-\"):\n old_chunk.append(rest)\n if tag in (\" \", \"+\"):\n new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L203_C6", "label": "if", "type": "if", "loc": [203, 204], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4", "vector": [4, 3, 0.7857, 0.0077, 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 tag in (\" \", \"-\"):\n old_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L204_C8", "label": "append()", "type": "expression", "loc": [204, 204], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L203_C6", "vector": [8, 4, 0.7876, 0.0039, 4, 0.24, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " old_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L205_C6", "label": "if", "type": "if", "loc": [205, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4", "vector": [4, 3, 0.7934, 0.0077, 3, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag in (\" \", \"+\"):\n new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L206_C8", "label": "append()", "type": "expression", "loc": [206, 206], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L205_C6", "vector": [8, 4, 0.7954, 0.0039, 4, 0.71, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_chunk.append(rest)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L208_C4", "label": "old_i, old_j =", "type": "assigned_variable", "loc": [208, 208], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [14, 2, 0.8031, 0.0039, 2, 0.89, 0.4286, 513, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_i, old_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_i, old_j = old_range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L209_C4", "label": "new_i, new_j =", "type": "assigned_variable", "loc": [209, 209], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [14, 2, 0.8069, 0.0039, 2, 0.89, 0.5714, 870, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_i, new_j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_i, new_j = new_range"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4", "label": "if", "type": "if", "loc": [210, 213], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [4, 2, 0.8166, 0.0154, 2, 0.89, 0.7143, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(old_chunk) != old_j - old_i or len(new_chunk) != new_j - new_i:\n print >> sys.stderr, (\"%s:%s: last chunk has incorrect length\" %\n (name, lineno))\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L211_C6", "label": "expression", "type": "expression", "loc": [211, 212], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4", "vector": [8, 3, 0.8166, 0.0077, 3, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " print >> sys.stderr, (\"%s:%s: last chunk has incorrect length\" %\n (name, lineno))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L213_C6", "label": "return", "type": "return", "loc": [213, 213], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4", "vector": [13, 3, 0.8224, 0.0039, 3, 0.91, 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_1184:Expr_L214_C4", "label": "append()", "type": "expression", "loc": [214, 214], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [8, 2, 0.8263, 0.0039, 2, 0.89, 0.8571, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " chunks.append((old_range, new_range, old_chunk, new_chunk))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L215_C4", "label": "raw_chunk =", "type": "assigned_variable", "loc": [215, 215], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "vector": [14, 2, 0.8301, 0.0039, 2, 0.89, 1.0, 6, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "raw_chunk", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " raw_chunk = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L216_C2", "label": "return", "type": "return", "loc": [216, 216], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "vector": [13, 1, 0.834, 0.0039, 1, 0.19, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return chunks"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "label": "ParsePatchToLines", "type": "function", "loc": [219, 259], "level": 0, "parent": null, "vector": [2, 0, 0.9228, 0.1583, 0, 0.66, 1.0, 791, 0, 1, 1, 0, 0, 0, 15], "semantic": {"name": "ParsePatchToLines", "arg_names": ["lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ParsePatchToLines(lines):\n \"\"\"Parses a patch from a list of lines.\n\n Returns None on error, otherwise a list of 3-tuples:\n (old_line_no, new_line_no, line)\n\n A line number can be 0 if it doesn't exist in the old/new file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L220_C2", "label": "expression", "type": "expression", "loc": [220, 226], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "vector": [8, 1, 0.861, 0.027, 1, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Parses a patch from a list of lines.\n\n Returns None on error, otherwise a list of 3-tuples:\n (old_line_no, new_line_no, line)\n\n A line number can be 0 if it doesn't exist in the old/new file.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L228_C2", "label": "result =", "type": "assigned_variable", "loc": [228, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "vector": [14, 1, 0.8803, 0.0039, 1, 0.53, 0.25, 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_1184:Assign_L229_C2", "label": "in_prelude =", "type": "assigned_variable", "loc": [229, 229], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "vector": [14, 1, 0.8842, 0.0039, 1, 0.53, 0.5, 59, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "in_prelude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_prelude = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L230_C2", "label": "for line", "type": "for", "loc": [230, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "vector": [6, 1, 0.9421, 0.112, 1, 0.53, 0.75, 373, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in lines:\n if in_prelude:\n result.append((0, 0, line))\n # Skip leading lines until after we've seen one starting with '+++'\n if line.startswith(\"+++\"):\n in_prelude = False\n elif line.startswith(\"@\"):\n result.append((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "label": "if", "type": "if", "loc": [231, 258], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L230_C2", "vector": [4, 2, 0.944, 0.1081, 2, 0.84, 0.0, 0, 2, 0, 0, 0, 0, 0, 15], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if in_prelude:\n result.append((0, 0, line))\n # Skip leading lines until after we've seen one starting with '+++'\n if line.startswith(\"+++\"):\n in_prelude = False\n elif line.startswith(\"@\"):\n result.append((0, 0, line))\n match = _CHUNK_RE.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L232_C6", "label": "append()", "type": "expression", "loc": [232, 232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "vector": [8, 3, 0.8958, 0.0039, 3, 0.91, 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((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L234_C6", "label": "if", "type": "if", "loc": [234, 235], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "vector": [4, 3, 0.9054, 0.0077, 3, 0.91, 0.5, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith(\"+++\"):\n in_prelude = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L235_C8", "label": "in_prelude =", "type": "assigned_variable", "loc": [235, 235], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L234_C6", "vector": [14, 4, 0.9073, 0.0039, 4, 0.43, 0.0, 59, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "in_prelude", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " in_prelude = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "label": "if", "type": "if", "loc": [236, 258], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "vector": [4, 3, 0.9537, 0.0888, 3, 0.91, 1.0, 0, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line.startswith(\"@\"):\n result.append((0, 0, line))\n match = _CHUNK_RE.match(line)\n if not match:\n logging.warn(\"ParsePatchToLines match failed on %s\", line)\n return None\n old_ln = int(match.groups()[0])\n new_ln = int(match.groups()[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L237_C6", "label": "append()", "type": "expression", "loc": [237, 237], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [8, 4, 0.9151, 0.0039, 4, 0.02, 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((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L238_C6", "label": "match = match()", "type": "assigned_variable", "loc": [238, 238], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [14, 4, 0.9189, 0.0039, 4, 0.02, 0.2, 36, 3, 1, 0, 0, 36, 10, 1], "semantic": {"name": "match", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " match = _CHUNK_RE.match(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6", "label": "if", "type": "if", "loc": [239, 241], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [4, 4, 0.9266, 0.0116, 4, 0.02, 0.4, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not match:\n logging.warn(\"ParsePatchToLines match failed on %s\", line)\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L240_C8", "label": "warn()", "type": "expression", "loc": [240, 240], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6", "vector": [8, 5, 0.9266, 0.0039, 5, 0.26, 0.0, 960, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "warn", "arg_names": [], "import_names": [], "rhs_call_name": "warn", "annotation": ""}, "snippet": " logging.warn(\"ParsePatchToLines match failed on %s\", line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L241_C8", "label": "return", "type": "return", "loc": [241, 241], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6", "vector": [13, 5, 0.9305, 0.0039, 5, 0.26, 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_1184:Assign_L242_C6", "label": "old_ln = int()", "type": "assigned_variable", "loc": [242, 242], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [14, 4, 0.9344, 0.0039, 4, 0.02, 0.6, 128, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "old_ln", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " old_ln = int(match.groups()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L243_C6", "label": "new_ln = int()", "type": "assigned_variable", "loc": [243, 243], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [14, 4, 0.9382, 0.0039, 4, 0.02, 0.8, 834, 3, 1, 0, 0, 901, 10, 2], "semantic": {"name": "new_ln", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " new_ln = int(match.groups()[2])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6", "label": "if", "type": "if", "loc": [245, 258], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "vector": [4, 4, 0.971, 0.0541, 4, 0.02, 1.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line[0] == \"-\":\n result.append((old_ln, 0, line))\n old_ln += 1\n elif line[0] == \"+\":\n result.append((0, new_ln, line))\n new_ln += 1\n elif line[0] == \" \":\n result.append((old_ln, new_ln, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L246_C8", "label": "append()", "type": "expression", "loc": [246, 246], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6", "vector": [8, 5, 0.9498, 0.0039, 5, 0.21, 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((old_ln, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6", "label": "if", "type": "if", "loc": [248, 258], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6", "vector": [4, 5, 0.9768, 0.0425, 5, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line[0] == \"+\":\n result.append((0, new_ln, line))\n new_ln += 1\n elif line[0] == \" \":\n result.append((old_ln, new_ln, line))\n old_ln += 1\n new_ln += 1\n elif line.startswith(_NO_NEWLINE_MESSAGE):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L249_C8", "label": "append()", "type": "expression", "loc": [249, 249], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6", "vector": [8, 6, 0.9614, 0.0039, 6, 0.95, 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((0, new_ln, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6", "label": "if", "type": "if", "loc": [251, 258], "level": 6, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6", "vector": [4, 6, 0.9826, 0.0309, 6, 0.95, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line[0] == \" \":\n result.append((old_ln, new_ln, line))\n old_ln += 1\n new_ln += 1\n elif line.startswith(_NO_NEWLINE_MESSAGE):\n continue\n else: # Something else, could be property changes etc.\n result.append((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L252_C8", "label": "append()", "type": "expression", "loc": [252, 252], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6", "vector": [8, 7, 0.973, 0.0039, 7, 0.89, 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((old_ln, new_ln, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L255_C6", "label": "if", "type": "if", "loc": [255, 258], "level": 7, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6", "vector": [4, 7, 0.9903, 0.0154, 7, 0.89, 1.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line.startswith(_NO_NEWLINE_MESSAGE):\n continue\n else: # Something else, could be property changes etc.\n result.append((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L258_C8", "label": "append()", "type": "expression", "loc": [258, 258], "level": 8, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L255_C6", "vector": [8, 8, 0.9961, 0.0039, 8, 0.77, 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((0, 0, line))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L259_C2", "label": "return", "type": "return", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "vector": [13, 1, 1.0, 0.0039, 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"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L51_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L68_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L82_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L83_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L84_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L102_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L103_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L93_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L119_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L120_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L121_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L122_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L123_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L124_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L127_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L127_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L129_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L129_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L130_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L132_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L125_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L136_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L137_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L139_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L139_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L140_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L138_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L141_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L141_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L142_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L144_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L145_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L147_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L146_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L149_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L150_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L134_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L151_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L153_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L154_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L159_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L158_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L161_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L163_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L165_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L164_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L167_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L168_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L169_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L172_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L171_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L174_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L175_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L175_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L176_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L175_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L178_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L179_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L180_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L182_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L133_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L184_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L183_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L188_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L187_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L189_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L189_C10", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L190_C12"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L193_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L193_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L194_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L195_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L185_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L197_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L200_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L203_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L203_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L204_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L202_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L205_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L205_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L206_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L208_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L209_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L211_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L210_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L213_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L214_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L198_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L215_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L110_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L216_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L220_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L228_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L229_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:For_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L232_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L234_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L234_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L235_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L237_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L238_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L240_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L239_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L241_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L242_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Assign_L243_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L246_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L245_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L249_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L248_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L252_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L251_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L255_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:If_L255_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Expr_L258_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1184:FunctionDef_L219_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1184:Return_L259_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""URL mappings for the codereview package."""
# NOTE: Must import *, since Django looks for things here, e.g. handler500.
from django.conf.urls.defaults import *
import django.views.defaults
from codereview import feeds
urlpatterns = patterns(
'codereview.views',
(r'^$', 'index'),
(r'^all$', 'all'),
(r'^mine$', 'mine'),
(r'^starred$', 'starred'),
(r'^new$', 'new'),
(r'^upload$', 'upload'),
(r'^(\d+)$', 'show', {}, 'show_bare_issue_number'),
(r'^(\d+)/(show)?$', 'show'),
(r'^(\d+)/add$', 'add'),
(r'^(\d+)/edit$', 'edit'),
(r'^(\d+)/delete$', 'delete'),
(r'^(\d+)/close$', 'close'),
(r'^(\d+)/mail$', 'mailissue'),
(r'^(\d+)/publish$', 'publish'),
(r'^download/issue(\d+)_(\d+)\.diff', 'download'),
(r'^download/issue(\d+)_(\d+)_(\d+)\.diff', 'download_patch'),
(r'^(\d+)/patch/(\d+)/(\d+)$', 'patch'),
(r'^(\d+)/image/(\d+)/(\d+)/(\d+)$', 'image'),
(r'^(\d+)/diff/(\d+)/(.+)$', 'diff'),
(r'^(\d+)/diff2/(\d+):(\d+)/(.+)$', 'diff2'),
(r'^(\d+)/diff_skipped_lines/(\d+)/(\d+)/(\d+)/(\d+)/([tba])/(\d+)$',
'diff_skipped_lines'),
(r'^(\d+)/diff_skipped_lines/(\d+)/(\d+)/$',
django.views.defaults.page_not_found, {}, 'diff_skipped_lines_prefix'),
(r'^(\d+)/diff2_skipped_lines/(\d+):(\d+)/(\d+)/(\d+)/(\d+)/([tba])/(\d+)$',
'diff2_skipped_lines'),
(r'^(\d+)/diff2_skipped_lines/(\d+):(\d+)/(\d+)/$',
django.views.defaults.page_not_found, {}, 'diff2_skipped_lines_prefix'),
(r'^(\d+)/upload_content/(\d+)/(\d+)$', 'upload_content'),
(r'^(\d+)/upload_patch/(\d+)$', 'upload_patch'),
(r'^(\d+)/upload_complete/(\d+)?$', 'upload_complete'),
(r'^(\d+)/description$', 'description'),
(r'^(\d+)/fields', 'fields'),
(r'^(\d+)/star$', 'star'),
(r'^(\d+)/unstar$', 'unstar'),
(r'^(\d+)/draft_message$', 'draft_message'),
(r'^api/(\d+)/?$', 'api_issue'),
(r'^api/(\d+)/(\d+)/?$', 'api_patchset'),
(r'^user/(.+)$', 'show_user'),
(r'^inline_draft$', 'inline_draft'),
(r'^repos$', 'repos'),
(r'^repo_new$', 'repo_new'),
(r'^repo_init$', 'repo_init'),
(r'^branch_new/(\d+)$', 'branch_new'),
(r'^branch_edit/(\d+)$', 'branch_edit'),
(r'^branch_delete/(\d+)$', 'branch_delete'),
(r'^settings$', 'settings'),
(r'^account_delete$', 'account_delete'),
(r'^migrate_entities$', 'migrate_entities'),
(r'^user_popup/(.+)$', 'user_popup'),
(r'^(\d+)/patchset/(\d+)$', 'patchset'),
(r'^(\d+)/patchset/(\d+)/delete$', 'delete_patchset'),
(r'^account$', 'account'),
(r'^use_uploadpy$', 'use_uploadpy'),
(r'^_ah/xmpp/message/chat/', 'incoming_chat'),
(r'^_ah/mail/(.*)', 'incoming_mail'),
(r'^xsrf_token$', 'xsrf_token'),
# patching upload.py on the fly
(r'^static/upload.py$', 'customized_upload_py'),
(r'^search$', 'search'),
(r'^tasks/calculate_delta$', 'calculate_delta'),
(r'^tasks/migrate_entities$', 'task_migrate_entities'),
)
feed_dict = {
'reviews': feeds.ReviewsFeed,
'closed': feeds.ClosedFeed,
'mine' : feeds.MineFeed,
'all': feeds.AllFeed,
'issue' : feeds.OneIssueFeed,
}
urlpatterns += patterns(
'',
(r'^rss/(?P<url>.*)$', 'django.contrib.syndication.views.feed',
{'feed_dict': feed_dict}),
)
| ajibawa-2023/Python-Code-Large/train/row_1185 | 6 | 101 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1185:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.1485, 0.0099, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"URL mappings for the codereview package.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1185:ImportFrom_L18_C0", "label": "from django.conf.urls.defaults import *", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.1782, 0.0099, 0, 0.66, 0.2, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "django.conf.urls.defaults", "arg_names": [], "import_names": ["*"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.conf.urls.defaults import *"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1185:Import_L19_C0", "label": "django.views.defaults import django.views.defaults", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1881, 0.0099, 0, 0.66, 0.4, 160, 0, 1, 0, 0, 160, 0, 0], "semantic": {"name": "django.views.defaults", "arg_names": [], "import_names": ["django.views.defaults"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.views.defaults"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1185:ImportFrom_L21_C0", "label": "from codereview import feeds", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.2079, 0.0099, 0, 0.66, 0.6, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["feeds"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import feeds"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1185:Assign_L23_C0", "label": "urlpatterns = patterns()", "type": "assigned_variable", "loc": [23, 87], "level": 0, "parent": null, "vector": [14, 0, 0.5446, 0.6436, 0, 0.66, 0.8, 990, 3, 58, 0, 0, 75, 10, 1], "semantic": {"name": "urlpatterns", "arg_names": [], "import_names": [], "rhs_call_name": "patterns", "annotation": ""}, "snippet": "urlpatterns = patterns(\n 'codereview.views',\n (r'^$', 'index'),\n (r'^all$', 'all'),\n (r'^mine$', 'mine'),\n (r'^starred$', 'starred'),\n (r'^new$', 'new'),\n (r'^upload$', 'upload'),"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1185:Assign_L89_C0", "label": "feed_dict =", "type": "assigned_variable", "loc": [89, 95], "level": 0, "parent": null, "vector": [14, 0, 0.9109, 0.0693, 0, 0.66, 1.0, 770, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "feed_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "feed_dict = {\n 'reviews': feeds.ReviewsFeed,\n 'closed': feeds.ClosedFeed,\n 'mine' : feeds.MineFeed,\n 'all': feeds.AllFeed,\n 'issue' : feeds.OneIssueFeed,\n}"}] | [] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Custom middleware. Some of this may be generally useful."""
import logging
from google.appengine.api import users
from google.appengine.runtime import apiproxy_errors
from google.appengine.runtime import DeadlineExceededError
from django.conf import settings
from django.http import Http404, HttpResponse
from django.template import Context, loader
from codereview import models
class AddUserToRequestMiddleware(object):
"""Add a user object and a user_is_admin flag to each request."""
def process_request(self, request):
request.user = users.get_current_user()
request.user_is_admin = users.is_current_user_admin()
# Update the cached value of the current user's Account
account = None
if request.user is not None:
account = models.Account.get_account_for_user(request.user)
models.Account.current_user_account = account
class PropagateExceptionMiddleware(object):
"""Catch exceptions, log them and return a friendly error message.
Disables itself in DEBUG mode.
"""
def _text_requested(self, request):
"""Returns True if a text/plain response is requested."""
# We could use a better heuristics that takes multiple
# media_ranges and quality factors into account. For now we return
# True iff 'text/plain' is the only media range the request
# accepts.
media_ranges = request.META.get('HTTP_ACCEPT', '').split(',')
return len(media_ranges) == 1 and media_ranges[0] == 'text/plain'
def process_exception(self, request, exception):
if settings.DEBUG or isinstance(exception, Http404):
return None
if isinstance(exception, apiproxy_errors.CapabilityDisabledError):
msg = ('Rietveld: App Engine is undergoing maintenance. '
'Please try again in a while.')
status = 503
elif isinstance(exception, (DeadlineExceededError, MemoryError)):
msg = ('Rietveld is too hungry at the moment.'
'Please try again in a while.')
status = 503
else:
msg = 'Unhandled exception.'
status = 500
logging.exception('%s: ' % exception.__class__.__name__)
technical = '%s [%s]' % (exception, exception.__class__.__name__)
if self._text_requested(request):
content = '%s\n\n%s\n' % (msg, technical)
content_type = 'text/plain'
else:
tpl = loader.get_template('exception.html')
ctx = Context({'msg': msg, 'technical': technical})
content = tpl.render(ctx)
content_type = 'text/html'
return HttpResponse(content, status=status, content_type=content_type)
| ajibawa-2023/Python-Code-Large/train/row_1186 | 45 | 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_1186:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.1807, 0.012, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Custom middleware. Some of this may be generally useful.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Import_L17_C0", "label": "logging import logging", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.2048, 0.012, 0, 0.66, 0.1, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "logging", "arg_names": [], "import_names": ["logging"], "rhs_call_name": "", "annotation": ""}, "snippet": "import logging"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L19_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.2289, 0.012, 0, 0.66, 0.2, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L20_C0", "label": "from google.appengine.runtime import apiproxy_errors", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.241, 0.012, 0, 0.66, 0.3, 155, 0, 1, 0, 0, 155, 0, 0], "semantic": {"name": "google.appengine.runtime", "arg_names": [], "import_names": ["apiproxy_errors"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.runtime import apiproxy_errors"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L21_C0", "label": "from google.appengine.runtime import DeadlineExceededError", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.253, 0.012, 0, 0.66, 0.4, 155, 0, 1, 0, 0, 155, 0, 0], "semantic": {"name": "google.appengine.runtime", "arg_names": [], "import_names": ["DeadlineExceededError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.runtime import DeadlineExceededError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L23_C0", "label": "from django.conf import settings", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.2771, 0.012, 0, 0.66, 0.5, 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_1186:ImportFrom_L24_C0", "label": "from django.http import Http404, HttpResponse", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.2892, 0.012, 0, 0.66, 0.6, 779, 0, 2, 0, 0, 779, 0, 0], "semantic": {"name": "django.http", "arg_names": [], "import_names": ["Http404", "HttpResponse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.http import Http404, HttpResponse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L25_C0", "label": "from django.template import Context, loader", "type": "import", "loc": [25, 25], "level": 0, "parent": null, "vector": [1, 0, 0.3012, 0.012, 0, 0.66, 0.7, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["Context", "loader"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import Context, loader"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ImportFrom_L27_C0", "label": "from codereview import models", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.3253, 0.012, 0, 0.66, 0.8, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L30_C0", "label": "AddUserToRequestMiddleware", "type": "class", "loc": [30, 41], "level": 0, "parent": null, "vector": [3, 0, 0.4277, 0.1446, 0, 0.66, 0.9, 299, 0, 1, 0, 0, 186, 0, 3], "semantic": {"name": "AddUserToRequestMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class AddUserToRequestMiddleware(object):\n \"\"\"Add a user object and a user_is_admin flag to each request.\"\"\"\n\n def process_request(self, request):\n request.user = users.get_current_user()\n request.user_is_admin = users.is_current_user_admin()\n\n # Update the cached value of the current user's Account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L31_C2", "label": "expression", "type": "expression", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L30_C0", "vector": [8, 1, 0.3735, 0.012, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Add a user object and a user_is_admin flag to each request.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "label": "process_request", "type": "function", "loc": [33, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L30_C0", "vector": [2, 1, 0.4458, 0.1084, 1, 0.27, 1.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 request.user = users.get_current_user()\n request.user_is_admin = users.is_current_user_admin()\n\n # Update the cached value of the current user's Account\n account = None\n if request.user is not None:\n account = models.Account.get_account_for_user(request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L34_C4", "label": "request.user = get_current_user()", "type": "assigned_variable", "loc": [34, 34], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "vector": [14, 2, 0.4096, 0.012, 2, 0.11, 0.0, 12, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "request.user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " request.user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L35_C4", "label": "request.user_is_admin = is_current_user_admin()", "type": "assigned_variable", "loc": [35, 35], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "vector": [14, 2, 0.4217, 0.012, 2, 0.11, 0.25, 481, 3, 0, 0, 0, 948, 10, 1], "semantic": {"name": "request.user_is_admin", "arg_names": [], "import_names": [], "rhs_call_name": "is_current_user_admin", "annotation": ""}, "snippet": " request.user_is_admin = users.is_current_user_admin()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L38_C4", "label": "account =", "type": "assigned_variable", "loc": [38, 38], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "vector": [14, 2, 0.4578, 0.012, 2, 0.11, 0.5, 492, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " account = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L39_C4", "label": "if", "type": "if", "loc": [39, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "vector": [4, 2, 0.4759, 0.0241, 2, 0.11, 0.75, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request.user is not None:\n account = models.Account.get_account_for_user(request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L40_C6", "label": "account = get_account_for_user()", "type": "assigned_variable", "loc": [40, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L39_C4", "vector": [14, 3, 0.4819, 0.012, 3, 0.44, 0.0, 492, 3, 1, 0, 0, 776, 10, 1], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "get_account_for_user", "annotation": ""}, "snippet": " account = models.Account.get_account_for_user(request.user)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L41_C4", "label": "models.Account.current_user_account =", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "vector": [14, 2, 0.494, 0.012, 2, 0.11, 1.0, 649, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "models.Account.current_user_account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " models.Account.current_user_account = account"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "label": "PropagateExceptionMiddleware", "type": "class", "loc": [44, 83], "level": 0, "parent": null, "vector": [3, 0, 0.7651, 0.4819, 0, 0.66, 1.0, 574, 0, 2, 0, 0, 186, 0, 12], "semantic": {"name": "PropagateExceptionMiddleware", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class PropagateExceptionMiddleware(object):\n \"\"\"Catch exceptions, log them and return a friendly error message.\n Disables itself in DEBUG mode.\n \"\"\"\n\n def _text_requested(self, request):\n \"\"\"Returns True if a text/plain response is requested.\"\"\"\n # We could use a better heuristics that takes multiple"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L45_C2", "label": "expression", "type": "expression", "loc": [45, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "vector": [8, 1, 0.5542, 0.0361, 1, 0.67, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Catch exceptions, log them and return a friendly error message.\n Disables itself in DEBUG mode.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "label": "_text_requested", "type": "function", "loc": [49, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "vector": [2, 1, 0.6325, 0.0964, 1, 0.67, 0.5, 838, 0, 2, 1, 0, 0, 0, 3], "semantic": {"name": "_text_requested", "arg_names": ["self", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def _text_requested(self, request):\n \"\"\"Returns True if a text/plain response is requested.\"\"\"\n # We could use a better heuristics that takes multiple\n # media_ranges and quality factors into account. For now we return\n # True iff 'text/plain' is the only media range the request\n # accepts.\n media_ranges = request.META.get('HTTP_ACCEPT', '').split(',')\n return len(media_ranges) == 1 and media_ranges[0] == 'text/plain'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L50_C4", "label": "expression", "type": "expression", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "vector": [8, 2, 0.6024, 0.012, 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 True if a text/plain response is requested.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L55_C4", "label": "media_ranges = split()", "type": "assigned_variable", "loc": [55, 55], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "vector": [14, 2, 0.6627, 0.012, 2, 0.28, 0.5, 159, 3, 1, 0, 0, 908, 10, 2], "semantic": {"name": "media_ranges", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " media_ranges = request.META.get('HTTP_ACCEPT', '').split(',')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "vector": [13, 2, 0.6747, 0.012, 2, 0.28, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return len(media_ranges) == 1 and media_ranges[0] == 'text/plain'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "label": "process_exception", "type": "function", "loc": [59, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "vector": [2, 1, 0.8554, 0.3012, 1, 0.67, 1.0, 751, 0, 3, 1, 0, 0, 0, 9], "semantic": {"name": "process_exception", "arg_names": ["self", "request", "exception"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def process_exception(self, request, exception):\n if settings.DEBUG or isinstance(exception, Http404):\n return None\n if isinstance(exception, apiproxy_errors.CapabilityDisabledError):\n msg = ('Rietveld: App Engine is undergoing maintenance. '\n 'Please try again in a while.')\n status = 503\n elif isinstance(exception, (DeadlineExceededError, MemoryError)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L60_C4", "label": "if", "type": "if", "loc": [60, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [4, 2, 0.7289, 0.0241, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if settings.DEBUG or isinstance(exception, Http404):\n return None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L61_C6", "label": "return", "type": "return", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L60_C4", "vector": [13, 3, 0.7349, 0.012, 3, 0.63, 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_1186:If_L62_C4", "label": "if", "type": "if", "loc": [62, 72], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [4, 2, 0.8072, 0.1325, 2, 0.32, 0.2, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(exception, apiproxy_errors.CapabilityDisabledError):\n msg = ('Rietveld: App Engine is undergoing maintenance. '\n 'Please try again in a while.')\n status = 503\n elif isinstance(exception, (DeadlineExceededError, MemoryError)):\n msg = ('Rietveld is too hungry at the moment.'\n 'Please try again in a while.')\n status = 503"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L63_C6", "label": "msg =", "type": "assigned_variable", "loc": [63, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "vector": [14, 3, 0.7651, 0.0241, 3, 0.56, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = ('Rietveld: App Engine is undergoing maintenance. '\n 'Please try again in a while.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L65_C6", "label": "status =", "type": "assigned_variable", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "vector": [14, 3, 0.7831, 0.012, 3, 0.56, 0.5, 699, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = 503"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "label": "if", "type": "if", "loc": [66, 72], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "vector": [4, 3, 0.8313, 0.0843, 3, 0.56, 1.0, 0, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(exception, (DeadlineExceededError, MemoryError)):\n msg = ('Rietveld is too hungry at the moment.'\n 'Please try again in a while.')\n status = 503\n else:\n msg = 'Unhandled exception.'\n status = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L67_C6", "label": "msg =", "type": "assigned_variable", "loc": [67, 68], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "vector": [14, 4, 0.8133, 0.0241, 4, 0.67, 0.0, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = ('Rietveld is too hungry at the moment.'\n 'Please try again in a while.')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L69_C6", "label": "status =", "type": "assigned_variable", "loc": [69, 69], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "vector": [14, 4, 0.8313, 0.012, 4, 0.67, 0.3333, 699, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = 503"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L71_C6", "label": "msg =", "type": "assigned_variable", "loc": [71, 71], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "vector": [14, 4, 0.8554, 0.012, 4, 0.67, 0.6667, 712, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg = 'Unhandled exception.'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L72_C6", "label": "status =", "type": "assigned_variable", "loc": [72, 72], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "vector": [14, 4, 0.8675, 0.012, 4, 0.67, 1.0, 699, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "status", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " status = 500"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L73_C4", "label": "exception()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [8, 2, 0.8795, 0.012, 2, 0.32, 0.4, 69, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exception", "arg_names": [], "import_names": [], "rhs_call_name": "exception", "annotation": ""}, "snippet": " logging.exception('%s: ' % exception.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L74_C4", "label": "technical =", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [14, 2, 0.8916, 0.012, 2, 0.32, 0.6, 334, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "technical", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " technical = '%s [%s]' % (exception, exception.__class__.__name__)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "label": "if", "type": "if", "loc": [75, 82], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [4, 2, 0.9458, 0.0964, 2, 0.32, 0.8, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self._text_requested(request):\n content = '%s\\n\\n%s\\n' % (msg, technical)\n content_type = 'text/plain'\n else:\n tpl = loader.get_template('exception.html')\n ctx = Context({'msg': msg, 'technical': technical})\n content = tpl.render(ctx)\n content_type = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L76_C6", "label": "content =", "type": "assigned_variable", "loc": [76, 76], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.9157, 0.012, 3, 0.98, 0.0, 273, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content = '%s\\n\\n%s\\n' % (msg, technical)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L77_C6", "label": "content_type =", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.9277, 0.012, 3, 0.98, 0.2, 610, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_type = 'text/plain'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L79_C6", "label": "tpl = get_template()", "type": "assigned_variable", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.9518, 0.012, 3, 0.98, 0.4, 321, 3, 1, 0, 0, 27, 10, 1], "semantic": {"name": "tpl", "arg_names": [], "import_names": [], "rhs_call_name": "get_template", "annotation": ""}, "snippet": " tpl = loader.get_template('exception.html')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L80_C6", "label": "ctx = Context()", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.9639, 0.012, 3, 0.98, 0.6, 827, 3, 1, 0, 0, 560, 10, 1], "semantic": {"name": "ctx", "arg_names": [], "import_names": [], "rhs_call_name": "Context", "annotation": ""}, "snippet": " ctx = Context({'msg': msg, 'technical': technical})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L81_C6", "label": "content = render()", "type": "assigned_variable", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.9759, 0.012, 3, 0.98, 0.8, 273, 3, 1, 0, 0, 24, 10, 1], "semantic": {"name": "content", "arg_names": [], "import_names": [], "rhs_call_name": "render", "annotation": ""}, "snippet": " content = tpl.render(ctx)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L82_C6", "label": "content_type =", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "vector": [14, 3, 0.988, 0.012, 3, 0.98, 1.0, 610, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "content_type", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " content_type = 'text/html'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L83_C4", "label": "return", "type": "return", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "vector": [13, 2, 1.0, 0.012, 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 HttpResponse(content, status=status, content_type=content_type)"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L30_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L35_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L39_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L39_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L40_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L62_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L69_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L71_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L72_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L76_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L77_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:If_L75_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Assign_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1186:FunctionDef_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1186:Return_L83_C4"}] |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Collection of helper functions."""
import urlparse
from google.appengine.ext import db
from codereview.exceptions import FetchError
def make_url(base, filename, rev):
"""Helper to construct the URL to fetch.
Args:
base: The base property of the Issue to which the Patch belongs.
filename: The filename property of the Patch instance.
rev: Revision number, or None for head revision.
Returns:
A URL referring to the given revision of the file.
"""
scheme, netloc, path, _, _, _ = urlparse.urlparse(base)
if netloc.endswith(".googlecode.com"):
# Handle Google code repositories
if rev is None:
raise FetchError("Can't access googlecode.com without a revision")
if not path.startswith("/svn/"):
raise FetchError( "Malformed googlecode.com URL (%s)" % base)
path = path[5:] # Strip "/svn/"
url = "%s://%s/svn-history/r%d/%s/%s" % (scheme, netloc, rev,
path, filename)
return url
elif netloc.endswith("sourceforge.net") and rev is not None:
if path.strip().endswith("/"):
path = path.strip()[:-1]
else:
path = path.strip()
splitted_path = path.split("/")
url = "%s://%s/%s/!svn/bc/%d/%s/%s" % (scheme, netloc,
"/".join(splitted_path[1:3]), rev,
"/".join(splitted_path[3:]),
filename)
return url
# Default for viewvc-based URLs (svn.python.org)
url = base
if not url.endswith('/'):
url += '/'
url += filename
if rev is not None:
url += '?rev=%s' % rev
return url
def to_dbtext(text):
"""Helper to turn a string into a db.Text instance.
Args:
text: a string.
Returns:
A db.Text instance.
"""
if isinstance(text, unicode):
# A TypeError is raised if text is unicode and an encoding is given.
return db.Text(text)
else:
try:
return db.Text(text, encoding='utf-8')
except UnicodeDecodeError:
return db.Text(text, encoding='latin-1')
def unify_linebreaks(text):
"""Helper to return a string with all line breaks converted to LF.
Args:
text: a string.
Returns:
A string with all line breaks converted to LF.
"""
return text.replace('\r\n', '\n').replace('\r', '\n')
| ajibawa-2023/Python-Code-Large/train/row_1187 | 34 | 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_1187:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.1562, 0.0104, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Collection of helper functions.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Import_L17_C0", "label": "urlparse import urlparse", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.1771, 0.0104, 0, 0.66, 0.1667, 857, 0, 1, 0, 0, 857, 0, 0], "semantic": {"name": "urlparse", "arg_names": [], "import_names": ["urlparse"], "rhs_call_name": "", "annotation": ""}, "snippet": "import urlparse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:ImportFrom_L19_C0", "label": "from google.appengine.ext import db", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.1979, 0.0104, 0, 0.66, 0.3333, 167, 0, 1, 0, 0, 167, 0, 0], "semantic": {"name": "google.appengine.ext", "arg_names": [], "import_names": ["db"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.ext import db"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:ImportFrom_L21_C0", "label": "from codereview.exceptions import FetchError", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.2188, 0.0104, 0, 0.66, 0.5, 962, 0, 1, 0, 0, 962, 0, 0], "semantic": {"name": "codereview.exceptions", "arg_names": [], "import_names": ["FetchError"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview.exceptions import FetchError"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "label": "make_url", "type": "function", "loc": [24, 64], "level": 0, "parent": null, "vector": [2, 0, 0.4583, 0.4271, 0, 0.66, 0.6667, 780, 0, 3, 1, 0, 0, 0, 14], "semantic": {"name": "make_url", "arg_names": ["base", "filename", "rev"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def make_url(base, filename, rev):\n \"\"\"Helper to construct the URL to fetch.\n\n Args:\n base: The base property of the Issue to which the Patch belongs.\n filename: The filename property of the Patch instance.\n rev: Revision number, or None for head revision.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L25_C2", "label": "expression", "type": "expression", "loc": [25, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [8, 1, 0.3073, 0.1042, 1, 0.31, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper to construct the URL to fetch.\n\n Args:\n base: The base property of the Issue to which the Patch belongs.\n filename: The filename property of the Patch instance.\n rev: Revision number, or None for head revision.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L35_C2", "label": "scheme, netloc, path, _, _, _ = urlparse()", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [14, 1, 0.3646, 0.0104, 1, 0.31, 0.1667, 241, 3, 1, 0, 0, 857, 10, 1], "semantic": {"name": "scheme, netloc, path, _, _, _", "arg_names": [], "import_names": [], "rhs_call_name": "urlparse", "annotation": ""}, "snippet": " scheme, netloc, path, _, _, _ = urlparse.urlparse(base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "label": "if", "type": "if", "loc": [36, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [4, 1, 0.4792, 0.2188, 1, 0.31, 0.3333, 0, 3, 0, 0, 0, 0, 0, 12], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if netloc.endswith(\".googlecode.com\"):\n # Handle Google code repositories\n if rev is None:\n raise FetchError(\"Can't access googlecode.com without a revision\")\n if not path.startswith(\"/svn/\"):\n raise FetchError( \"Malformed googlecode.com URL (%s)\" % base)\n path = path[5:] # Strip \"/svn/\"\n url = \"%s://%s/svn-history/r%d/%s/%s\" % (scheme, netloc, rev,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L38_C4", "label": "if", "type": "if", "loc": [38, 39], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [4, 2, 0.401, 0.0208, 2, 0.32, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev is None:\n raise FetchError(\"Can't access googlecode.com without a revision\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L40_C4", "label": "if", "type": "if", "loc": [40, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [4, 2, 0.4219, 0.0208, 2, 0.32, 0.2, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not path.startswith(\"/svn/\"):\n raise FetchError( \"Malformed googlecode.com URL (%s)\" % base)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L42_C4", "label": "path =", "type": "assigned_variable", "loc": [42, 42], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [14, 2, 0.4375, 0.0104, 2, 0.32, 0.4, 358, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = path[5:] # Strip \"/svn/\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L43_C4", "label": "url =", "type": "assigned_variable", "loc": [43, 44], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [14, 2, 0.4531, 0.0208, 2, 0.32, 0.6, 789, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = \"%s://%s/svn-history/r%d/%s/%s\" % (scheme, netloc, rev,\n path, filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L45_C4", "label": "return", "type": "return", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [13, 2, 0.4688, 0.0104, 2, 0.32, 0.8, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "label": "if", "type": "if", "loc": [46, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "vector": [4, 2, 0.5312, 0.1146, 2, 0.32, 1.0, 0, 0, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif netloc.endswith(\"sourceforge.net\") and rev is not None:\n if path.strip().endswith(\"/\"):\n path = path.strip()[:-1]\n else:\n path = path.strip()\n splitted_path = path.split(\"/\")\n url = \"%s://%s/%s/!svn/bc/%d/%s/%s\" % (scheme, netloc,\n \"/\".join(splitted_path[1:3]), rev,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4", "label": "if", "type": "if", "loc": [47, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "vector": [4, 3, 0.5052, 0.0417, 3, 0.45, 0.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if path.strip().endswith(\"/\"):\n path = path.strip()[:-1]\n else:\n path = path.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L48_C6", "label": "path =", "type": "assigned_variable", "loc": [48, 48], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4", "vector": [14, 4, 0.5, 0.0104, 4, 0.71, 0.0, 358, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " path = path.strip()[:-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L50_C6", "label": "path = strip()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4", "vector": [14, 4, 0.5208, 0.0104, 4, 0.71, 1.0, 358, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "path", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " path = path.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L51_C4", "label": "splitted_path = split()", "type": "assigned_variable", "loc": [51, 51], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "vector": [14, 3, 0.5312, 0.0104, 3, 0.45, 0.3333, 880, 3, 1, 0, 0, 908, 10, 1], "semantic": {"name": "splitted_path", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " splitted_path = path.split(\"/\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L52_C4", "label": "url =", "type": "assigned_variable", "loc": [52, 55], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "vector": [14, 3, 0.5573, 0.0417, 3, 0.45, 0.6667, 789, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = \"%s://%s/%s/!svn/bc/%d/%s/%s\" % (scheme, netloc,\n \"/\".join(splitted_path[1:3]), rev,\n \"/\".join(splitted_path[3:]),\n filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "vector": [13, 3, 0.5833, 0.0104, 3, 0.45, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L58_C2", "label": "url =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [14, 1, 0.6042, 0.0104, 1, 0.31, 0.5, 789, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "url", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url = base"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L59_C2", "label": "if", "type": "if", "loc": [59, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [4, 1, 0.6198, 0.0208, 1, 0.31, 0.6667, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not url.endswith('/'):\n url += '/'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L62_C2", "label": "if", "type": "if", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [4, 1, 0.651, 0.0208, 1, 0.31, 0.8333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if rev is not None:\n url += '?rev=%s' % rev"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L64_C2", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "vector": [13, 1, 0.6667, 0.0104, 1, 0.31, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return url"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L67_C0", "label": "to_dbtext", "type": "function", "loc": [67, 83], "level": 0, "parent": null, "vector": [2, 0, 0.7812, 0.1771, 0, 0.66, 0.8333, 809, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "to_dbtext", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def to_dbtext(text):\n \"\"\"Helper to turn a string into a db.Text instance.\n\n Args:\n text: a string.\n\n Returns:\n A db.Text instance."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L68_C2", "label": "expression", "type": "expression", "loc": [68, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L67_C0", "vector": [8, 1, 0.7448, 0.0833, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper to turn a string into a db.Text instance.\n\n Args:\n text: a string.\n\n Returns:\n A db.Text instance.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2", "label": "if", "type": "if", "loc": [76, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L67_C0", "vector": [4, 1, 0.8281, 0.0833, 1, 0.19, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(text, unicode):\n # A TypeError is raised if text is unicode and an encoding is given.\n return db.Text(text)\n else:\n try:\n return db.Text(text, encoding='utf-8')\n except UnicodeDecodeError:\n return db.Text(text, encoding='latin-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L78_C4", "label": "return", "type": "return", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2", "vector": [13, 2, 0.8125, 0.0104, 2, 0.07, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db.Text(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4", "label": "try", "type": "try", "loc": [80, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2", "vector": [7, 2, 0.849, 0.0417, 2, 0.07, 1.0, 0, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n return db.Text(text, encoding='utf-8')\n except UnicodeDecodeError:\n return db.Text(text, encoding='latin-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L81_C6", "label": "return", "type": "return", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4", "vector": [13, 3, 0.8438, 0.0104, 3, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db.Text(text, encoding='utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L83_C6", "label": "return", "type": "return", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4", "vector": [13, 3, 0.8646, 0.0104, 3, 0.99, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return db.Text(text, encoding='latin-1')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L86_C0", "label": "unify_linebreaks", "type": "function", "loc": [86, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9427, 0.1042, 0, 0.66, 1.0, 427, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "unify_linebreaks", "arg_names": ["text"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def unify_linebreaks(text):\n \"\"\"Helper to return a string with all line breaks converted to LF.\n\n Args:\n text: a string.\n\n Returns:\n A string with all line breaks converted to LF."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L87_C2", "label": "expression", "type": "expression", "loc": [87, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L86_C0", "vector": [8, 1, 0.9427, 0.0833, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper to return a string with all line breaks converted to LF.\n\n Args:\n text: a string.\n\n Returns:\n A string with all line breaks converted to LF.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L95_C2", "label": "return", "type": "return", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L86_C0", "vector": [13, 1, 0.9896, 0.0104, 1, 0.42, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return text.replace('\\r\\n', '\\n').replace('\\r', '\\n')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L43_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L36_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L48_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L47_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L50_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L78_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:If_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:Try_L80_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Expr_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1187:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1187:Return_L95_C2"}] |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Exception classes."""
class RietveldError(Exception):
"""Base class for all exceptions in this application."""
class FetchError(RietveldError):
"""Exception raised when fetching of remote files fails."""
| ajibawa-2023/Python-Code-Large/train/row_1188 | 5 | 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_1188:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.6522, 0.0435, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Exception classes.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L18_C0", "label": "RietveldError", "type": "class", "loc": [18, 19], "level": 0, "parent": null, "vector": [3, 0, 0.8043, 0.087, 0, 0.66, 0.5, 654, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "RietveldError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class RietveldError(Exception):\n \"\"\"Base class for all exceptions in this application.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1188:Expr_L19_C2", "label": "expression", "type": "expression", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L18_C0", "vector": [8, 1, 0.8261, 0.0435, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Base class for all exceptions in this application.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L22_C0", "label": "FetchError", "type": "class", "loc": [22, 23], "level": 0, "parent": null, "vector": [3, 0, 0.9783, 0.087, 0, 0.66, 1.0, 576, 0, 0, 0, 0, 654, 0, 0], "semantic": {"name": "FetchError", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class FetchError(RietveldError):\n \"\"\"Exception raised when fetching of remote files fails.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1188:Expr_L23_C2", "label": "expression", "type": "expression", "loc": [23, 23], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L22_C0", "vector": [8, 1, 1.0, 0.0435, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Exception raised when fetching of remote files fails.\"\"\""}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1188:Expr_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1188:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1188:Expr_L23_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Django template library for Rietveld."""
import cgi
from google.appengine.api import memcache
from google.appengine.api import users
import django.template
import django.utils.safestring
from django.core.urlresolvers import reverse
from codereview import models
register = django.template.Library()
user_cache = {}
def get_links_for_users(user_emails):
"""Return a dictionary of email->link to user page and fill caches."""
link_dict = {}
remaining_emails = set(user_emails)
# initialize with email usernames
for email in remaining_emails:
nick = email.split('@', 1)[0]
link_dict[email] = cgi.escape(nick)
# look in the local cache
for email in remaining_emails:
if email in user_cache:
link_dict[email] = user_cache[email]
remaining_emails = remaining_emails - set(user_cache)
if not remaining_emails:
return link_dict
# then look in memcache
memcache_results = memcache.get_multi(remaining_emails,
key_prefix="show_user:")
for email in memcache_results:
link_dict[email] = memcache_results[email]
user_cache[email] = memcache_results[email]
remaining_emails = remaining_emails - set(memcache_results)
if not remaining_emails:
return link_dict
# and finally hit the datastore
accounts = models.Account.get_accounts_for_emails(remaining_emails)
for account in accounts:
if account and account.user_has_selected_nickname:
ret = ('<a href="%s" onMouseOver="M_showUserInfoPopup(this)">%s</a>' %
(reverse('codereview.views.show_user', args=[account.nickname]),
cgi.escape(account.nickname)))
link_dict[account.email] = ret
datastore_results = dict((e, link_dict[e]) for e in remaining_emails)
memcache.set_multi(datastore_results, 300, key_prefix='show_user:')
user_cache.update(datastore_results)
return link_dict
def get_link_for_user(email):
"""Get a link to a user's profile page."""
links = get_links_for_users([email])
return links[email]
@register.filter
def show_user(email, arg=None, _autoescape=None, _memcache_results=None):
"""Render a link to the user's dashboard, with text being the nickname."""
if isinstance(email, users.User):
email = email.email()
if not arg:
user = users.get_current_user()
if user is not None and email == user.email():
return 'me'
ret = get_link_for_user(email)
return django.utils.safestring.mark_safe(ret)
@register.filter
def show_users(email_list, arg=None):
"""Render list of links to each user's dashboard."""
new_email_list = []
for email in email_list:
if isinstance(email, users.User):
email = email.email()
new_email_list.append(email)
links = get_links_for_users(new_email_list)
if not arg:
user = users.get_current_user()
if user is not None:
links[user.email()] = 'me'
return django.utils.safestring.mark_safe(', '.join(
links[email] for email in email_list))
class UrlAppendViewSettingsNode(django.template.Node):
"""Django template tag that appends context and column_width parameter.
This tag should be used after any URL that requires view settings.
Example:
<a href='{%url /foo%}{%urlappend_view_settings%}'>
The tag tries to get the current column width and context from the
template context and if they're present it returns '?param1¶m2'
otherwise it returns an empty string.
"""
def __init__(self):
super(UrlAppendViewSettingsNode, self).__init__()
self.view_context = django.template.Variable('context')
self.view_colwidth = django.template.Variable('column_width')
def render(self, context):
"""Returns a HTML fragment."""
url_params = []
current_context = -1
try:
current_context = self.view_context.resolve(context)
except django.template.VariableDoesNotExist:
pass
if current_context is None:
url_params.append('context=')
elif isinstance(current_context, int) and current_context > 0:
url_params.append('context=%d' % current_context)
current_colwidth = None
try:
current_colwidth = self.view_colwidth.resolve(context)
except django.template.VariableDoesNotExist:
pass
if current_colwidth is not None:
url_params.append('column_width=%d' % current_colwidth)
if url_params:
return '?%s' % '&'.join(url_params)
return ''
@register.tag
def urlappend_view_settings(_parser, _token):
"""The actual template tag."""
return UrlAppendViewSettingsNode()
def get_nickname(email, never_me=False, request=None):
"""Return a nickname for an email address.
If 'never_me' is True, 'me' is not returned if 'email' belongs to the
current logged in user. If 'request' is a HttpRequest, it is used to
cache the nickname returned by models.Account.get_nickname_for_email().
"""
if isinstance(email, users.User):
email = email.email()
if not never_me:
if request is not None:
user = request.user
else:
user = users.get_current_user()
if user is not None and email == user.email():
return 'me'
if request is None:
return models.Account.get_nickname_for_email(email)
# _nicknames is injected into request as a cache.
# TODO(maruel): Use memcache instead.
# Access to a protected member _nicknames of a client class
# pylint: disable=W0212
if getattr(request, '_nicknames', None) is None:
request._nicknames = {}
if email in request._nicknames:
return request._nicknames[email]
result = models.Account.get_nickname_for_email(email)
request._nicknames[email] = result
return result
class NicknameNode(django.template.Node):
"""Renders a nickname for a given email address.
The return value is cached if a HttpRequest is available in a
'request' template variable.
The template tag accepts one or two arguments. The first argument is
the template variable for the email address. If the optional second
argument evaluates to True, 'me' as nickname is never rendered.
Example usage:
{% cached_nickname msg.sender %}
{% cached_nickname msg.sender True %}
"""
def __init__(self, email_address, never_me=''):
"""Constructor.
'email_address' is the name of the template variable that holds an
email address. If 'never_me' evaluates to True, 'me' won't be returned.
"""
super(NicknameNode, self).__init__()
self.email_address = django.template.Variable(email_address)
self.never_me = bool(never_me.strip())
self.is_multi = False
def render(self, context):
try:
email = self.email_address.resolve(context)
except django.template.VariableDoesNotExist:
return ''
request = context.get('request')
if self.is_multi:
return ', '.join(get_nickname(e, self.never_me, request) for e in email)
return get_nickname(email, self.never_me, request)
@register.tag
def nickname(_parser, token):
"""Almost the same as nickname filter but the result is cached."""
try:
_, email_address, never_me = token.split_contents()
except ValueError:
try:
_, email_address = token.split_contents()
never_me = ''
except ValueError:
raise django.template.TemplateSyntaxError(
"%r requires exactly one or two arguments" % token.contents.split()[0])
return NicknameNode(email_address, never_me)
@register.tag
def nicknames(parser, token):
"""Wrapper for nickname tag with is_multi flag enabled."""
node = nickname(parser, token)
node.is_multi = True
return node
| ajibawa-2023/Python-Code-Large/train/row_1189 | 141 | 261 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0575, 0.0038, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Django template library for Rietveld.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Import_L17_C0", "label": "cgi import cgi", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0651, 0.0038, 0, 0.66, 0.0526, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:ImportFrom_L19_C0", "label": "from google.appengine.api import memcache", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0728, 0.0038, 0, 0.66, 0.1053, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["memcache"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import memcache"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:ImportFrom_L20_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [20, 20], "level": 0, "parent": null, "vector": [1, 0, 0.0766, 0.0038, 0, 0.66, 0.1579, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Import_L22_C0", "label": "django.template import django.template", "type": "import", "loc": [22, 22], "level": 0, "parent": null, "vector": [1, 0, 0.0843, 0.0038, 0, 0.66, 0.2105, 213, 0, 1, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["django.template"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.template"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Import_L23_C0", "label": "django.utils.safestring import django.utils.safestring", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0881, 0.0038, 0, 0.66, 0.2632, 375, 0, 1, 0, 0, 375, 0, 0], "semantic": {"name": "django.utils.safestring", "arg_names": [], "import_names": ["django.utils.safestring"], "rhs_call_name": "", "annotation": ""}, "snippet": "import django.utils.safestring"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:ImportFrom_L24_C0", "label": "from django.core.urlresolvers import reverse", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.092, 0.0038, 0, 0.66, 0.3158, 749, 0, 1, 0, 0, 749, 0, 0], "semantic": {"name": "django.core.urlresolvers", "arg_names": [], "import_names": ["reverse"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.core.urlresolvers import reverse"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:ImportFrom_L26_C0", "label": "from codereview import models", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.0996, 0.0038, 0, 0.66, 0.3684, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L28_C0", "label": "register = Library()", "type": "assigned_variable", "loc": [28, 28], "level": 0, "parent": null, "vector": [14, 0, 0.1073, 0.0038, 0, 0.66, 0.4211, 276, 3, 0, 0, 0, 77, 10, 1], "semantic": {"name": "register", "arg_names": [], "import_names": [], "rhs_call_name": "Library", "annotation": ""}, "snippet": "register = django.template.Library()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L30_C0", "label": "user_cache =", "type": "assigned_variable", "loc": [30, 30], "level": 0, "parent": null, "vector": [14, 0, 0.1149, 0.0038, 0, 0.66, 0.4737, 540, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "user_cache", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "user_cache = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "label": "get_links_for_users", "type": "function", "loc": [33, 76], "level": 0, "parent": null, "vector": [2, 0, 0.2088, 0.1686, 0, 0.66, 0.5263, 844, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "get_links_for_users", "arg_names": ["user_emails"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_links_for_users(user_emails):\n \"\"\"Return a dictionary of email->link to user page and fill caches.\"\"\"\n link_dict = {}\n remaining_emails = set(user_emails)\n \n # initialize with email usernames\n for email in remaining_emails:\n nick = email.split('@', 1)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L34_C2", "label": "expression", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [8, 1, 0.1303, 0.0038, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a dictionary of email->link to user page and fill caches.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L35_C2", "label": "link_dict =", "type": "assigned_variable", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.1341, 0.0038, 1, 0.91, 0.0625, 602, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "link_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " link_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L36_C2", "label": "remaining_emails = set()", "type": "assigned_variable", "loc": [36, 36], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.1379, 0.0038, 1, 0.91, 0.125, 489, 3, 1, 0, 0, 21, 10, 1], "semantic": {"name": "remaining_emails", "arg_names": [], "import_names": [], "rhs_call_name": "set", "annotation": ""}, "snippet": " remaining_emails = set(user_emails)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2", "label": "for email", "type": "for", "loc": [39, 41], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [6, 1, 0.1533, 0.0115, 1, 0.91, 0.1875, 413, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for email in remaining_emails:\n nick = email.split('@', 1)[0]\n link_dict[email] = cgi.escape(nick)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L40_C4", "label": "nick =", "type": "assigned_variable", "loc": [40, 40], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2", "vector": [14, 2, 0.1533, 0.0038, 2, 0.84, 0.0, 622, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "nick", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nick = email.split('@', 1)[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L41_C4", "label": " = escape()", "type": "assigned_variable", "loc": [41, 41], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2", "vector": [14, 2, 0.1571, 0.0038, 2, 0.84, 1.0, 0, 3, 1, 0, 0, 494, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "escape", "annotation": ""}, "snippet": " link_dict[email] = cgi.escape(nick)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L44_C2", "label": "for email", "type": "for", "loc": [44, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [6, 1, 0.1724, 0.0115, 1, 0.91, 0.25, 413, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for email in remaining_emails:\n if email in user_cache:\n link_dict[email] = user_cache[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L45_C4", "label": "if", "type": "if", "loc": [45, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L44_C2", "vector": [4, 2, 0.1743, 0.0077, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if email in user_cache:\n link_dict[email] = user_cache[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L46_C6", "label": "assign", "type": "assigned_variable", "loc": [46, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L45_C4", "vector": [14, 3, 0.1762, 0.0038, 3, 0.23, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " link_dict[email] = user_cache[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L47_C2", "label": "remaining_emails =", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.1801, 0.0038, 1, 0.91, 0.3125, 489, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remaining_emails", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " remaining_emails = remaining_emails - set(user_cache)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L49_C2", "label": "if", "type": "if", "loc": [49, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [4, 1, 0.1897, 0.0077, 1, 0.91, 0.375, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not remaining_emails:\n return link_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L50_C4", "label": "return", "type": "return", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L49_C2", "vector": [13, 2, 0.1916, 0.0038, 2, 0.72, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return link_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L53_C2", "label": "memcache_results = get_multi()", "type": "assigned_variable", "loc": [53, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.205, 0.0077, 1, 0.91, 0.4375, 627, 3, 2, 0, 0, 150, 10, 1], "semantic": {"name": "memcache_results", "arg_names": [], "import_names": [], "rhs_call_name": "get_multi", "annotation": ""}, "snippet": " memcache_results = memcache.get_multi(remaining_emails,\n key_prefix=\"show_user:\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2", "label": "for email", "type": "for", "loc": [55, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [6, 1, 0.2146, 0.0115, 1, 0.91, 0.5, 413, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for email in memcache_results:\n link_dict[email] = memcache_results[email]\n user_cache[email] = memcache_results[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L56_C4", "label": "assign", "type": "assigned_variable", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2", "vector": [14, 2, 0.2146, 0.0038, 2, 0.74, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " link_dict[email] = memcache_results[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L57_C4", "label": "assign", "type": "assigned_variable", "loc": [57, 57], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2", "vector": [14, 2, 0.2184, 0.0038, 2, 0.74, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user_cache[email] = memcache_results[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L58_C2", "label": "remaining_emails =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.2222, 0.0038, 1, 0.91, 0.5625, 489, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "remaining_emails", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " remaining_emails = remaining_emails - set(memcache_results)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L60_C2", "label": "if", "type": "if", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [4, 1, 0.2318, 0.0077, 1, 0.91, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not remaining_emails:\n return link_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L61_C4", "label": "return", "type": "return", "loc": [61, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L60_C2", "vector": [13, 2, 0.2337, 0.0038, 2, 0.9, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return link_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L64_C2", "label": "accounts = get_accounts_for_emails()", "type": "assigned_variable", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.2452, 0.0038, 1, 0.91, 0.6875, 729, 3, 1, 0, 0, 885, 10, 1], "semantic": {"name": "accounts", "arg_names": [], "import_names": [], "rhs_call_name": "get_accounts_for_emails", "annotation": ""}, "snippet": " accounts = models.Account.get_accounts_for_emails(remaining_emails)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L65_C2", "label": "for account", "type": "for", "loc": [65, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [6, 1, 0.2586, 0.023, 1, 0.91, 0.75, 492, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "account", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for account in accounts:\n if account and account.user_has_selected_nickname:\n ret = ('<a href=\"%s\" onMouseOver=\"M_showUserInfoPopup(this)\">%s</a>' %\n (reverse('codereview.views.show_user', args=[account.nickname]),\n cgi.escape(account.nickname)))\n link_dict[account.email] = ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4", "label": "if", "type": "if", "loc": [66, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L65_C2", "vector": [4, 2, 0.2605, 0.0192, 2, 0.99, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if account and account.user_has_selected_nickname:\n ret = ('<a href=\"%s\" onMouseOver=\"M_showUserInfoPopup(this)\">%s</a>' %\n (reverse('codereview.views.show_user', args=[account.nickname]),\n cgi.escape(account.nickname)))\n link_dict[account.email] = ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L67_C6", "label": "ret =", "type": "assigned_variable", "loc": [67, 69], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4", "vector": [14, 3, 0.2605, 0.0115, 3, 0.89, 0.0, 501, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ret = ('<a href=\"%s\" onMouseOver=\"M_showUserInfoPopup(this)\">%s</a>' %\n (reverse('codereview.views.show_user', args=[account.nickname]),\n cgi.escape(account.nickname)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L70_C6", "label": "assign", "type": "assigned_variable", "loc": [70, 70], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4", "vector": [14, 3, 0.2682, 0.0038, 3, 0.89, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " link_dict[account.email] = ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L72_C2", "label": "datastore_results = dict()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [14, 1, 0.2759, 0.0038, 1, 0.91, 0.8125, 941, 3, 1, 0, 0, 827, 10, 1], "semantic": {"name": "datastore_results", "arg_names": [], "import_names": [], "rhs_call_name": "dict", "annotation": ""}, "snippet": " datastore_results = dict((e, link_dict[e]) for e in remaining_emails)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L73_C2", "label": "set_multi()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [8, 1, 0.2797, 0.0038, 1, 0.91, 0.875, 366, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "set_multi", "arg_names": [], "import_names": [], "rhs_call_name": "set_multi", "annotation": ""}, "snippet": " memcache.set_multi(datastore_results, 300, key_prefix='show_user:')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L74_C2", "label": "update()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [8, 1, 0.2835, 0.0038, 1, 0.91, 0.9375, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " user_cache.update(datastore_results)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L76_C2", "label": "return", "type": "return", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "vector": [13, 1, 0.2912, 0.0038, 1, 0.91, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return link_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "label": "get_link_for_user", "type": "function", "loc": [79, 82], "level": 0, "parent": null, "vector": [2, 0, 0.3084, 0.0153, 0, 0.66, 0.5789, 890, 0, 1, 1, 0, 0, 0, 1], "semantic": {"name": "get_link_for_user", "arg_names": ["email"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_link_for_user(email):\n \"\"\"Get a link to a user's profile page.\"\"\"\n links = get_links_for_users([email])\n return links[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L80_C2", "label": "expression", "type": "expression", "loc": [80, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "vector": [8, 1, 0.3065, 0.0038, 1, 0.19, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Get a link to a user's profile page.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L81_C2", "label": "links = get_links_for_users()", "type": "assigned_variable", "loc": [81, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "vector": [14, 1, 0.3103, 0.0038, 1, 0.19, 0.5, 412, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "links", "arg_names": [], "import_names": [], "rhs_call_name": "get_links_for_users", "annotation": ""}, "snippet": " links = get_links_for_users([email])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "vector": [13, 1, 0.3142, 0.0038, 1, 0.19, 1.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return links[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "label": "show_user", "type": "function", "loc": [86, 97], "level": 0, "parent": null, "vector": [2, 0, 0.3506, 0.046, 0, 0.66, 0.6316, 567, 0, 4, 1, 0, 0, 0, 6], "semantic": {"name": "show_user", "arg_names": ["email", "arg", "_autoescape", "_memcache_results"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show_user(email, arg=None, _autoescape=None, _memcache_results=None):\n \"\"\"Render a link to the user's dashboard, with text being the nickname.\"\"\"\n if isinstance(email, users.User):\n email = email.email()\n if not arg:\n user = users.get_current_user()\n if user is not None and email == user.email():\n return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L87_C2", "label": "expression", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "vector": [8, 1, 0.3333, 0.0038, 1, 0.41, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render a link to the user's dashboard, with text being the nickname.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L88_C2", "label": "if", "type": "if", "loc": [88, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "vector": [4, 1, 0.3391, 0.0077, 1, 0.41, 0.25, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(email, users.User):\n email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L89_C4", "label": "email = email()", "type": "assigned_variable", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L88_C2", "vector": [14, 2, 0.341, 0.0038, 2, 0.52, 0.0, 413, 3, 0, 0, 0, 413, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "email", "annotation": ""}, "snippet": " email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2", "label": "if", "type": "if", "loc": [90, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "vector": [4, 1, 0.3506, 0.0153, 1, 0.41, 0.5, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not arg:\n user = users.get_current_user()\n if user is not None and email == user.email():\n return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L91_C4", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2", "vector": [14, 2, 0.3487, 0.0038, 2, 0.03, 0.0, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L92_C4", "label": "if", "type": "if", "loc": [92, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2", "vector": [4, 2, 0.3544, 0.0077, 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 user is not None and email == user.email():\n return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L93_C6", "label": "return", "type": "return", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L92_C4", "vector": [13, 3, 0.3563, 0.0038, 3, 0.35, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L95_C2", "label": "ret = get_link_for_user()", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "vector": [14, 1, 0.364, 0.0038, 1, 0.41, 0.75, 501, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "get_link_for_user", "annotation": ""}, "snippet": " ret = get_link_for_user(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L97_C2", "label": "return", "type": "return", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "vector": [13, 1, 0.3716, 0.0038, 1, 0.41, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return django.utils.safestring.mark_safe(ret)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "label": "show_users", "type": "function", "loc": [101, 117], "level": 0, "parent": null, "vector": [2, 0, 0.4176, 0.0651, 0, 0.66, 0.6842, 669, 0, 2, 1, 0, 0, 0, 8], "semantic": {"name": "show_users", "arg_names": ["email_list", "arg"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def show_users(email_list, arg=None):\n \"\"\"Render list of links to each user's dashboard.\"\"\"\n new_email_list = []\n for email in email_list:\n if isinstance(email, users.User):\n email = email.email()\n new_email_list.append(email)\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L102_C2", "label": "expression", "type": "expression", "loc": [102, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [8, 1, 0.3908, 0.0038, 1, 0.13, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render list of links to each user's dashboard.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L103_C2", "label": "new_email_list =", "type": "assigned_variable", "loc": [103, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [14, 1, 0.3946, 0.0038, 1, 0.13, 0.2, 113, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_email_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_email_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2", "label": "for email", "type": "for", "loc": [104, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [6, 1, 0.4042, 0.0153, 1, 0.13, 0.4, 413, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for email in email_list:\n if isinstance(email, users.User):\n email = email.email()\n new_email_list.append(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L105_C4", "label": "if", "type": "if", "loc": [105, 106], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2", "vector": [4, 2, 0.4042, 0.0077, 2, 0.56, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(email, users.User):\n email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L106_C6", "label": "email = email()", "type": "assigned_variable", "loc": [106, 106], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L105_C4", "vector": [14, 3, 0.4061, 0.0038, 3, 0.43, 0.0, 413, 3, 0, 0, 0, 413, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "email", "annotation": ""}, "snippet": " email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L107_C4", "label": "append()", "type": "expression", "loc": [107, 107], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2", "vector": [8, 2, 0.41, 0.0038, 2, 0.56, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_email_list.append(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L109_C2", "label": "links = get_links_for_users()", "type": "assigned_variable", "loc": [109, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [14, 1, 0.4176, 0.0038, 1, 0.13, 0.6, 412, 3, 1, 0, 0, 844, 10, 1], "semantic": {"name": "links", "arg_names": [], "import_names": [], "rhs_call_name": "get_links_for_users", "annotation": ""}, "snippet": " links = get_links_for_users(new_email_list)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2", "label": "if", "type": "if", "loc": [111, 114], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [4, 1, 0.431, 0.0153, 1, 0.13, 0.8, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not arg:\n user = users.get_current_user()\n if user is not None:\n links[user.email()] = 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L112_C4", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [112, 112], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2", "vector": [14, 2, 0.4291, 0.0038, 2, 0.73, 0.0, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L113_C4", "label": "if", "type": "if", "loc": [113, 114], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2", "vector": [4, 2, 0.4349, 0.0077, 2, 0.73, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if user is not None:\n links[user.email()] = 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L114_C6", "label": "assign", "type": "assigned_variable", "loc": [114, 114], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L113_C4", "vector": [14, 3, 0.4368, 0.0038, 3, 0.4, 0.0, 0, 1, 0, 0, 0, 0, 3, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " links[user.email()] = 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L116_C2", "label": "return", "type": "return", "loc": [116, 117], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "vector": [13, 1, 0.4464, 0.0077, 1, 0.13, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return django.utils.safestring.mark_safe(', '.join(\n links[email] for email in email_list))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "label": "UrlAppendViewSettingsNode", "type": "class", "loc": [120, 163], "level": 0, "parent": null, "vector": [3, 0, 0.5421, 0.1686, 0, 0.66, 0.7368, 263, 0, 2, 0, 0, 48, 0, 11], "semantic": {"name": "UrlAppendViewSettingsNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class UrlAppendViewSettingsNode(django.template.Node):\n \"\"\"Django template tag that appends context and column_width parameter.\n\n This tag should be used after any URL that requires view settings.\n\n Example:\n\n <a href='{%url /foo%}{%urlappend_view_settings%}'>"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L121_C2", "label": "expression", "type": "expression", "loc": [121, 132], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "vector": [8, 1, 0.4847, 0.046, 1, 0.04, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Django template tag that appends context and column_width parameter.\n\n This tag should be used after any URL that requires view settings.\n\n Example:\n\n <a href='{%url /foo%}{%urlappend_view_settings%}'>\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "label": "__init__", "type": "function", "loc": [134, 137], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "vector": [2, 1, 0.5192, 0.0153, 1, 0.04, 0.5, 555, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "__init__", "arg_names": ["self"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self):\n super(UrlAppendViewSettingsNode, self).__init__()\n self.view_context = django.template.Variable('context')\n self.view_colwidth = django.template.Variable('column_width')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L135_C4", "label": "__init__()", "type": "expression", "loc": [135, 135], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "vector": [8, 2, 0.5172, 0.0038, 2, 0.87, 0.0, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(UrlAppendViewSettingsNode, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L136_C4", "label": "self.view_context = Variable()", "type": "assigned_variable", "loc": [136, 136], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "vector": [14, 2, 0.5211, 0.0038, 2, 0.87, 0.5, 193, 3, 1, 0, 0, 807, 10, 1], "semantic": {"name": "self.view_context", "arg_names": [], "import_names": [], "rhs_call_name": "Variable", "annotation": ""}, "snippet": " self.view_context = django.template.Variable('context')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L137_C4", "label": "self.view_colwidth = Variable()", "type": "assigned_variable", "loc": [137, 137], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "vector": [14, 2, 0.5249, 0.0038, 2, 0.87, 1.0, 877, 3, 1, 0, 0, 807, 10, 1], "semantic": {"name": "self.view_colwidth", "arg_names": [], "import_names": [], "rhs_call_name": "Variable", "annotation": ""}, "snippet": " self.view_colwidth = django.template.Variable('column_width')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "label": "render", "type": "function", "loc": [139, 163], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "vector": [2, 1, 0.5785, 0.0958, 1, 0.04, 1.0, 24, 0, 2, 1, 0, 0, 0, 7], "semantic": {"name": "render", "arg_names": ["self", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def render(self, context):\n \"\"\"Returns a HTML fragment.\"\"\"\n url_params = []\n\n current_context = -1\n try:\n current_context = self.view_context.resolve(context)\n except django.template.VariableDoesNotExist:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L140_C4", "label": "expression", "type": "expression", "loc": [140, 140], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [8, 2, 0.5364, 0.0038, 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 HTML fragment.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L141_C4", "label": "url_params =", "type": "assigned_variable", "loc": [141, 141], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [14, 2, 0.5402, 0.0038, 2, 0.35, 0.1111, 664, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "url_params", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " url_params = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L143_C4", "label": "current_context =", "type": "assigned_variable", "loc": [143, 143], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [14, 2, 0.5479, 0.0038, 2, 0.35, 0.2222, 296, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "current_context", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current_context = -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L144_C4", "label": "try", "type": "try", "loc": [144, 147], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [7, 2, 0.5575, 0.0153, 2, 0.35, 0.3333, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n current_context = self.view_context.resolve(context)\n except django.template.VariableDoesNotExist:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L145_C6", "label": "current_context = resolve()", "type": "assigned_variable", "loc": [145, 145], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L144_C4", "vector": [14, 3, 0.5556, 0.0038, 3, 0.56, 0.0, 296, 3, 1, 0, 0, 675, 10, 1], "semantic": {"name": "current_context", "arg_names": [], "import_names": [], "rhs_call_name": "resolve", "annotation": ""}, "snippet": " current_context = self.view_context.resolve(context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4", "label": "if", "type": "if", "loc": [148, 151], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [4, 2, 0.5728, 0.0153, 2, 0.35, 0.4444, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if current_context is None:\n url_params.append('context=')\n elif isinstance(current_context, int) and current_context > 0:\n url_params.append('context=%d' % current_context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L149_C6", "label": "append()", "type": "expression", "loc": [149, 149], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4", "vector": [8, 3, 0.5709, 0.0038, 3, 0.62, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " url_params.append('context=')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L150_C4", "label": "if", "type": "if", "loc": [150, 151], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4", "vector": [4, 3, 0.5766, 0.0077, 3, 0.62, 1.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif isinstance(current_context, int) and current_context > 0:\n url_params.append('context=%d' % current_context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L151_C6", "label": "append()", "type": "expression", "loc": [151, 151], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L150_C4", "vector": [8, 4, 0.5785, 0.0038, 4, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " url_params.append('context=%d' % current_context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L153_C4", "label": "current_colwidth =", "type": "assigned_variable", "loc": [153, 153], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [14, 2, 0.5862, 0.0038, 2, 0.35, 0.5556, 379, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "current_colwidth", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " current_colwidth = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L154_C4", "label": "try", "type": "try", "loc": [154, 157], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [7, 2, 0.5958, 0.0153, 2, 0.35, 0.6667, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n current_colwidth = self.view_colwidth.resolve(context)\n except django.template.VariableDoesNotExist:\n pass"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L155_C6", "label": "current_colwidth = resolve()", "type": "assigned_variable", "loc": [155, 155], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L154_C4", "vector": [14, 3, 0.5939, 0.0038, 3, 0.5, 0.0, 379, 3, 1, 0, 0, 675, 10, 1], "semantic": {"name": "current_colwidth", "arg_names": [], "import_names": [], "rhs_call_name": "resolve", "annotation": ""}, "snippet": " current_colwidth = self.view_colwidth.resolve(context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L158_C4", "label": "if", "type": "if", "loc": [158, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [4, 2, 0.6073, 0.0077, 2, 0.35, 0.7778, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if current_colwidth is not None:\n url_params.append('column_width=%d' % current_colwidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L159_C6", "label": "append()", "type": "expression", "loc": [159, 159], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L158_C4", "vector": [8, 3, 0.6092, 0.0038, 3, 0.89, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " url_params.append('column_width=%d' % current_colwidth)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L161_C4", "label": "if", "type": "if", "loc": [161, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [4, 2, 0.6188, 0.0077, 2, 0.35, 0.8889, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if url_params:\n return '?%s' % '&'.join(url_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L162_C6", "label": "return", "type": "return", "loc": [162, 162], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L161_C4", "vector": [13, 3, 0.6207, 0.0038, 3, 0.68, 0.0, 0, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '?%s' % '&'.join(url_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L163_C4", "label": "return", "type": "return", "loc": [163, 163], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "vector": [13, 2, 0.6245, 0.0038, 2, 0.35, 1.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L166_C0", "label": "urlappend_view_settings", "type": "function", "loc": [166, 168], "level": 0, "parent": null, "vector": [2, 0, 0.6398, 0.0115, 0, 0.66, 0.7895, 471, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "urlappend_view_settings", "arg_names": ["_parser", "_token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def urlappend_view_settings(_parser, _token):\n \"\"\"The actual template tag.\"\"\"\n return UrlAppendViewSettingsNode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L167_C2", "label": "expression", "type": "expression", "loc": [167, 167], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L166_C0", "vector": [8, 1, 0.6398, 0.0038, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"The actual template tag.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L168_C2", "label": "return", "type": "return", "loc": [168, 168], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L166_C0", "vector": [13, 1, 0.6437, 0.0038, 1, 0.27, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return UrlAppendViewSettingsNode()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "label": "get_nickname", "type": "function", "loc": [171, 201], "level": 0, "parent": null, "vector": [2, 0, 0.7126, 0.1188, 0, 0.66, 0.8421, 441, 0, 3, 1, 0, 0, 0, 7], "semantic": {"name": "get_nickname", "arg_names": ["email", "never_me", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def get_nickname(email, never_me=False, request=None):\n \"\"\"Return a nickname for an email address.\n\n If 'never_me' is True, 'me' is not returned if 'email' belongs to the\n current logged in user. If 'request' is a HttpRequest, it is used to\n cache the nickname returned by models.Account.get_nickname_for_email().\n \"\"\"\n if isinstance(email, users.User):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L172_C2", "label": "expression", "type": "expression", "loc": [172, 177], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [8, 1, 0.6686, 0.023, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Return a nickname for an email address.\n\n If 'never_me' is True, 'me' is not returned if 'email' belongs to the\n current logged in user. If 'request' is a HttpRequest, it is used to\n cache the nickname returned by models.Account.get_nickname_for_email().\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L178_C2", "label": "if", "type": "if", "loc": [178, 179], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [4, 1, 0.6839, 0.0077, 1, 0.11, 0.125, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if isinstance(email, users.User):\n email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L179_C4", "label": "email = email()", "type": "assigned_variable", "loc": [179, 179], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L178_C2", "vector": [14, 2, 0.6858, 0.0038, 2, 0.63, 0.0, 413, 3, 0, 0, 0, 413, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "email", "annotation": ""}, "snippet": " email = email.email()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2", "label": "if", "type": "if", "loc": [180, 186], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [4, 1, 0.7011, 0.0268, 1, 0.11, 0.25, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if not never_me:\n if request is not None:\n user = request.user\n else:\n user = users.get_current_user()\n if user is not None and email == user.email():\n return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4", "label": "if", "type": "if", "loc": [181, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2", "vector": [4, 2, 0.6992, 0.0153, 2, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request is not None:\n user = request.user\n else:\n user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L182_C6", "label": "user =", "type": "assigned_variable", "loc": [182, 182], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4", "vector": [14, 3, 0.6973, 0.0038, 3, 0.33, 0.0, 503, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " user = request.user"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L184_C6", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4", "vector": [14, 3, 0.705, 0.0038, 3, 0.33, 1.0, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L185_C4", "label": "if", "type": "if", "loc": [185, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2", "vector": [4, 2, 0.7107, 0.0077, 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 user is not None and email == user.email():\n return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L186_C6", "label": "return", "type": "return", "loc": [186, 186], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L185_C4", "vector": [13, 3, 0.7126, 0.0038, 3, 0.29, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return 'me'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L188_C2", "label": "if", "type": "if", "loc": [188, 189], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [4, 1, 0.7222, 0.0077, 1, 0.11, 0.375, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if request is None:\n return models.Account.get_nickname_for_email(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L189_C4", "label": "return", "type": "return", "loc": [189, 189], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L188_C2", "vector": [13, 2, 0.7241, 0.0038, 2, 0.43, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return models.Account.get_nickname_for_email(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L195_C2", "label": "if", "type": "if", "loc": [195, 196], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [4, 1, 0.749, 0.0077, 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 getattr(request, '_nicknames', None) is None:\n request._nicknames = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L196_C4", "label": "request._nicknames =", "type": "assigned_variable", "loc": [196, 196], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L195_C2", "vector": [14, 2, 0.751, 0.0038, 2, 0.73, 0.0, 374, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "request._nicknames", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request._nicknames = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L197_C2", "label": "if", "type": "if", "loc": [197, 198], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [4, 1, 0.7567, 0.0077, 1, 0.11, 0.625, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if email in request._nicknames:\n return request._nicknames[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L198_C4", "label": "return", "type": "return", "loc": [198, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L197_C2", "vector": [13, 2, 0.7586, 0.0038, 2, 0.37, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return request._nicknames[email]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L199_C2", "label": "result = get_nickname_for_email()", "type": "assigned_variable", "loc": [199, 199], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [14, 1, 0.7625, 0.0038, 1, 0.11, 0.75, 51, 3, 1, 0, 0, 700, 10, 1], "semantic": {"name": "result", "arg_names": [], "import_names": [], "rhs_call_name": "get_nickname_for_email", "annotation": ""}, "snippet": " result = models.Account.get_nickname_for_email(email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L200_C2", "label": "assign", "type": "assigned_variable", "loc": [200, 200], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [14, 1, 0.7663, 0.0038, 1, 0.11, 0.875, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " request._nicknames[email] = result"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L201_C2", "label": "return", "type": "return", "loc": [201, 201], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "vector": [13, 1, 0.7701, 0.0038, 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_1189:ClassDef_L204_C0", "label": "NicknameNode", "type": "class", "loc": [204, 238], "level": 0, "parent": null, "vector": [3, 0, 0.8467, 0.1341, 0, 0.66, 0.8947, 910, 0, 2, 0, 0, 48, 0, 10], "semantic": {"name": "NicknameNode", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "class NicknameNode(django.template.Node):\n \"\"\"Renders a nickname for a given email address.\n\n The return value is cached if a HttpRequest is available in a\n 'request' template variable.\n\n The template tag accepts one or two arguments. The first argument is\n the template variable for the email address. If the optional second"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L205_C2", "label": "expression", "type": "expression", "loc": [205, 217], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "vector": [8, 1, 0.8084, 0.0498, 1, 0.87, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Renders a nickname for a given email address.\n\n The return value is cached if a HttpRequest is available in a\n 'request' template variable.\n\n The template tag accepts one or two arguments. The first argument is\n the template variable for the email address. If the optional second\n argument evaluates to True, 'me' as nickname is never rendered."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "label": "__init__", "type": "function", "loc": [219, 228], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "vector": [2, 1, 0.8563, 0.0383, 1, 0.87, 0.5, 555, 0, 3, 0, 0, 0, 0, 5], "semantic": {"name": "__init__", "arg_names": ["self", "email_address", "never_me"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def __init__(self, email_address, never_me=''):\n \"\"\"Constructor.\n\n 'email_address' is the name of the template variable that holds an\n email address. If 'never_me' evaluates to True, 'me' won't be returned.\n \"\"\"\n super(NicknameNode, self).__init__()\n self.email_address = django.template.Variable(email_address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L220_C4", "label": "expression", "type": "expression", "loc": [220, 224], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "vector": [8, 2, 0.8506, 0.0192, 2, 0.43, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Constructor.\n\n 'email_address' is the name of the template variable that holds an\n email address. If 'never_me' evaluates to True, 'me' won't be returned.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L225_C4", "label": "__init__()", "type": "expression", "loc": [225, 225], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "vector": [8, 2, 0.8621, 0.0038, 2, 0.43, 0.25, 555, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "__init__", "arg_names": [], "import_names": [], "rhs_call_name": "__init__", "annotation": ""}, "snippet": " super(NicknameNode, self).__init__()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L226_C4", "label": "self.email_address = Variable()", "type": "assigned_variable", "loc": [226, 226], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "vector": [14, 2, 0.8659, 0.0038, 2, 0.43, 0.5, 740, 3, 1, 0, 0, 807, 10, 1], "semantic": {"name": "self.email_address", "arg_names": [], "import_names": [], "rhs_call_name": "Variable", "annotation": ""}, "snippet": " self.email_address = django.template.Variable(email_address)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L227_C4", "label": "self.never_me = bool()", "type": "assigned_variable", "loc": [227, 227], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "vector": [14, 2, 0.8697, 0.0038, 2, 0.43, 0.75, 683, 3, 1, 0, 0, 337, 10, 2], "semantic": {"name": "self.never_me", "arg_names": [], "import_names": [], "rhs_call_name": "bool", "annotation": ""}, "snippet": " self.never_me = bool(never_me.strip())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L228_C4", "label": "self.is_multi =", "type": "assigned_variable", "loc": [228, 228], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "vector": [14, 2, 0.8736, 0.0038, 2, 0.43, 1.0, 500, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "self.is_multi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " self.is_multi = False"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "label": "render", "type": "function", "loc": [230, 238], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "vector": [2, 1, 0.8966, 0.0345, 1, 0.87, 1.0, 24, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "render", "arg_names": ["self", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " def render(self, context):\n try:\n email = self.email_address.resolve(context)\n except django.template.VariableDoesNotExist:\n return ''\n request = context.get('request')\n if self.is_multi:\n return ', '.join(get_nickname(e, self.never_me, request) for e in email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4", "label": "try", "type": "try", "loc": [231, 234], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "vector": [7, 2, 0.8908, 0.0153, 2, 0.69, 0.0, 0, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n email = self.email_address.resolve(context)\n except django.template.VariableDoesNotExist:\n return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L232_C6", "label": "email = resolve()", "type": "assigned_variable", "loc": [232, 232], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4", "vector": [14, 3, 0.8889, 0.0038, 3, 0.53, 0.0, 413, 3, 1, 0, 0, 675, 10, 1], "semantic": {"name": "email", "arg_names": [], "import_names": [], "rhs_call_name": "resolve", "annotation": ""}, "snippet": " email = self.email_address.resolve(context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L234_C6", "label": "return", "type": "return", "loc": [234, 234], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4", "vector": [13, 3, 0.8966, 0.0038, 3, 0.53, 0.0, 0, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L235_C4", "label": "request = get()", "type": "assigned_variable", "loc": [235, 235], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "vector": [14, 2, 0.9004, 0.0038, 2, 0.69, 0.3333, 50, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "request", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " request = context.get('request')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L236_C4", "label": "if", "type": "if", "loc": [236, 237], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "vector": [4, 2, 0.9061, 0.0077, 2, 0.69, 0.6667, 0, 7, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if self.is_multi:\n return ', '.join(get_nickname(e, self.never_me, request) for e in email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L237_C6", "label": "return", "type": "return", "loc": [237, 237], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L236_C4", "vector": [13, 3, 0.908, 0.0038, 3, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ', '.join(get_nickname(e, self.never_me, request) for e in email)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L238_C4", "label": "return", "type": "return", "loc": [238, 238], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "vector": [13, 2, 0.9119, 0.0038, 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 get_nickname(email, self.never_me, request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "label": "nickname", "type": "function", "loc": [242, 253], "level": 0, "parent": null, "vector": [2, 0, 0.9483, 0.046, 0, 0.66, 0.9474, 289, 0, 2, 1, 0, 0, 0, 5], "semantic": {"name": "nickname", "arg_names": ["_parser", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def nickname(_parser, token):\n \"\"\"Almost the same as nickname filter but the result is cached.\"\"\"\n try:\n _, email_address, never_me = token.split_contents()\n except ValueError:\n try:\n _, email_address = token.split_contents()\n never_me = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L243_C2", "label": "expression", "type": "expression", "loc": [243, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "vector": [8, 1, 0.931, 0.0038, 1, 0.3, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Almost the same as nickname filter but the result is cached.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2", "label": "try", "type": "try", "loc": [244, 252], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "vector": [7, 1, 0.9502, 0.0345, 1, 0.3, 0.5, 0, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n _, email_address, never_me = token.split_contents()\n except ValueError:\n try:\n _, email_address = token.split_contents()\n never_me = ''\n except ValueError:\n raise django.template.TemplateSyntaxError("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L245_C4", "label": "_, email_address, never_me = split_contents()", "type": "assigned_variable", "loc": [245, 245], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2", "vector": [14, 2, 0.9387, 0.0038, 2, 0.89, 0.0, 670, 3, 0, 0, 0, 28, 10, 1], "semantic": {"name": "_, email_address, never_me", "arg_names": [], "import_names": [], "rhs_call_name": "split_contents", "annotation": ""}, "snippet": " _, email_address, never_me = token.split_contents()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4", "label": "try", "type": "try", "loc": [247, 252], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2", "vector": [7, 2, 0.9559, 0.023, 2, 0.89, 0.0, 0, 0, 1, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " try:\n _, email_address = token.split_contents()\n never_me = ''\n except ValueError:\n raise django.template.TemplateSyntaxError(\n \"%r requires exactly one or two arguments\" % token.contents.split()[0])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L248_C6", "label": "_, email_address = split_contents()", "type": "assigned_variable", "loc": [248, 248], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4", "vector": [14, 3, 0.9502, 0.0038, 3, 0.55, 0.0, 212, 3, 0, 0, 0, 28, 10, 1], "semantic": {"name": "_, email_address", "arg_names": [], "import_names": [], "rhs_call_name": "split_contents", "annotation": ""}, "snippet": " _, email_address = token.split_contents()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L249_C6", "label": "never_me =", "type": "assigned_variable", "loc": [249, 249], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4", "vector": [14, 3, 0.954, 0.0038, 3, 0.55, 1.0, 398, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "never_me", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " never_me = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L253_C2", "label": "return", "type": "return", "loc": [253, 253], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "vector": [13, 1, 0.9693, 0.0038, 1, 0.3, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return NicknameNode(email_address, never_me)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "label": "nicknames", "type": "function", "loc": [257, 261], "level": 0, "parent": null, "vector": [2, 0, 0.9923, 0.0192, 0, 0.66, 1.0, 660, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "nicknames", "arg_names": ["parser", "token"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def nicknames(parser, token):\n \"\"\"Wrapper for nickname tag with is_multi flag enabled.\"\"\"\n node = nickname(parser, token)\n node.is_multi = True\n return node"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L258_C2", "label": "expression", "type": "expression", "loc": [258, 258], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "vector": [8, 1, 0.9885, 0.0038, 1, 0.27, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Wrapper for nickname tag with is_multi flag enabled.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L259_C2", "label": "node = nickname()", "type": "assigned_variable", "loc": [259, 259], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "vector": [14, 1, 0.9923, 0.0038, 1, 0.27, 0.3333, 772, 3, 2, 0, 0, 289, 10, 1], "semantic": {"name": "node", "arg_names": [], "import_names": [], "rhs_call_name": "nickname", "annotation": ""}, "snippet": " node = nickname(parser, token)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L260_C2", "label": "node.is_multi =", "type": "assigned_variable", "loc": [260, 260], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "vector": [14, 1, 0.9962, 0.0038, 1, 0.27, 0.6667, 777, 1, 0, 0, 0, 0, 4, 0], "semantic": {"name": "node.is_multi", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " node.is_multi = True"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L261_C2", "label": "return", "type": "return", "loc": [261, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "vector": [13, 1, 1.0, 0.0038, 1, 0.27, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return node"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L36_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L40_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L39_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L45_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L46_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L65_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L70_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L80_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L81_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L79_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L92_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L93_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L102_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L103_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L105_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L105_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L106_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:For_L104_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L107_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L109_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L112_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L111_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L113_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L113_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L114_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L101_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L121_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L135_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L136_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L134_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L137_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L120_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L140_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L141_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L143_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L144_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L144_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L145_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L149_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L148_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L150_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L150_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L151_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L153_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L154_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L154_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L155_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L158_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L158_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L159_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L161_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L161_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L162_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L139_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L163_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L167_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L166_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L168_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L172_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L178_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L178_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L179_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L182_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L181_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L184_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L180_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L185_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L185_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L186_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L188_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L188_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L189_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L195_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L195_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L196_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L197_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L197_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L198_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L199_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L200_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L171_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L201_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L205_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L220_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L225_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L226_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L227_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L219_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L228_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:ClassDef_L204_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L232_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L231_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L234_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L235_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L236_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:If_L236_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L237_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L230_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L238_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L243_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L245_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L244_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L248_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:Try_L247_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L249_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L242_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L253_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Expr_L258_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L259_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Assign_L260_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1189:FunctionDef_L257_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1189:Return_L261_C2"}] |
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Diff rendering in HTML for Rietveld."""
import cgi
import difflib
import re
from google.appengine.api import users
from django.conf import settings
from django.template import loader, RequestContext
from codereview import intra_region_diff
from codereview import models
from codereview import patching
from codereview import utils
# NOTE: The SplitPatch function is duplicated in upload.py, keep them in sync.
def SplitPatch(data):
"""Splits a patch into separate pieces for each file.
Args:
data: A string containing the output of svn diff.
Returns:
A list of 2-tuple (filename, text) where text is the svn diff output
pertaining to filename.
"""
patches = []
filename = None
diff = []
for line in data.splitlines(True):
new_filename = None
if line.startswith('Index:'):
_, new_filename = line.split(':', 1)
new_filename = new_filename.strip()
elif line.startswith('Property changes on:'):
_, temp_filename = line.split(':', 1)
# When a file is modified, paths use '/' between directories, however
# when a property is modified '\' is used on Windows. Make them the same
# otherwise the file shows up twice.
temp_filename = temp_filename.strip().replace('\\', '/')
if temp_filename != filename:
# File has property changes but no modifications, create a new diff.
new_filename = temp_filename
if new_filename:
if filename and diff:
patches.append((filename, ''.join(diff)))
filename = new_filename
diff = [line]
continue
if diff is not None:
diff.append(line)
if filename and diff:
patches.append((filename, ''.join(diff)))
return patches
def ParsePatchSet(patchset):
"""Patch a patch set into individual patches.
Args:
patchset: a models.PatchSet instance.
Returns:
A list of models.Patch instances.
"""
patches = []
for filename, text in SplitPatch(patchset.data):
patches.append(models.Patch(patchset=patchset, text=utils.to_dbtext(text),
filename=filename, parent=patchset))
return patches
def RenderDiffTableRows(request, old_lines, chunks, patch,
colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False,
context=settings.DEFAULT_CONTEXT):
"""Render the HTML table rows for a side-by-side diff for a patch.
Args:
request: Django Request object.
old_lines: List of lines representing the original file.
chunks: List of chunks as returned by patching.ParsePatchToChunks().
patch: A models.Patch instance.
colwidth: Optional column width (default 80).
debug: Optional debugging flag (default False).
context: Maximum number of rows surrounding a change (default CONTEXT).
Yields:
Strings, each of which represents the text rendering one complete
pair of lines of the side-by-side diff, possibly including comments.
Each yielded string may consist of several <tr> elements.
"""
rows = _RenderDiffTableRows(request, old_lines, chunks, patch,
colwidth, debug)
return _CleanupTableRowsGenerator(rows, context)
def RenderDiff2TableRows(request, old_lines, old_patch, new_lines, new_patch,
colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False,
context=settings.DEFAULT_CONTEXT):
"""Render the HTML table rows for a side-by-side diff between two patches.
Args:
request: Django Request object.
old_lines: List of lines representing the patched file on the left.
old_patch: The models.Patch instance corresponding to old_lines.
new_lines: List of lines representing the patched file on the right.
new_patch: The models.Patch instance corresponding to new_lines.
colwidth: Optional column width (default 80).
debug: Optional debugging flag (default False).
context: Maximum number of visible context lines (default
settings.DEFAULT_CONTEXT).
Yields:
Strings, each of which represents the text rendering one complete
pair of lines of the side-by-side diff, possibly including comments.
Each yielded string may consist of several <tr> elements.
"""
rows = _RenderDiff2TableRows(request, old_lines, old_patch,
new_lines, new_patch, colwidth, debug)
return _CleanupTableRowsGenerator(rows, context)
def _CleanupTableRowsGenerator(rows, context):
"""Cleanup rows returned by _TableRowGenerator for output.
Args:
rows: List of tuples (tag, text)
context: Maximum number of visible context lines.
Yields:
Rows marked as 'equal' are possibly contracted using _ShortenBuffer().
Stops on rows marked as 'error'.
"""
buffer = []
for tag, text in rows:
if tag == 'equal':
buffer.append(text)
continue
else:
for t in _ShortenBuffer(buffer, context):
yield t
buffer = []
yield text
if tag == 'error':
yield None
break
if buffer:
for t in _ShortenBuffer(buffer, context):
yield t
def _ShortenBuffer(buffer, context):
"""Render a possibly contracted series of HTML table rows.
Args:
buffer: a list of strings representing HTML table rows.
context: Maximum number of visible context lines. If None all lines are
returned.
Yields:
If the buffer has fewer than 3 times context items, yield all
the items. Otherwise, yield the first context items, a single
table row representing the contraction, and the last context
items.
"""
if context is None or len(buffer) < 3*context:
for t in buffer:
yield t
else:
last_id = None
for t in buffer[:context]:
m = re.match('^<tr( name="hook")? id="pair-(?P<rowcount>\d+)">', t)
if m:
last_id = int(m.groupdict().get("rowcount"))
yield t
skip = len(buffer) - 2*context
expand_link = []
if skip > 3*context:
expand_link.append(('<a href="javascript:M_expandSkipped(%(before)d, '
'%(after)d, \'t\', %(skip)d)">'
'Expand %(context)d before'
'</a> | '))
expand_link.append(('<a href="javascript:M_expandSkipped(%(before)d, '
'%(after)d, \'a\', %(skip)d)">Expand all</a>'))
if skip > 3*context:
expand_link.append((' | '
'<a href="javascript:M_expandSkipped(%(before)d, '
'%(after)d, \'b\', %(skip)d)">'
'Expand %(context)d after'
'</a>'))
expand_link = ''.join(expand_link) % {'before': last_id+1,
'after': last_id+skip,
'skip': last_id,
'context': max(context, None)}
yield ('<tr id="skip-%d"><td colspan="2" align="center" '
'style="background:lightblue">'
'(...skipping <span id="skipcount-%d">%d</span> matching lines...) '
'<span id="skiplinks-%d">%s</span> '
'<span id="skiploading-%d" style="visibility:hidden;">Loading...'
'</span>'
'</td></tr>\n' % (last_id, last_id, skip,
last_id, expand_link, last_id))
for t in buffer[-context:]:
yield t
def _RenderDiff2TableRows(request, old_lines, old_patch, new_lines, new_patch,
colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False):
"""Internal version of RenderDiff2TableRows().
Args:
The same as for RenderDiff2TableRows.
Yields:
Tuples (tag, row) where tag is an indication of the row type.
"""
old_dict = {}
new_dict = {}
for patch, dct in [(old_patch, old_dict), (new_patch, new_dict)]:
# XXX GQL doesn't support OR yet... Otherwise we'd be using that.
for comment in models.Comment.gql(
'WHERE patch = :1 AND left = FALSE ORDER BY date', patch):
if comment.draft and comment.author != request.user:
continue # Only show your own drafts
comment.complete()
lst = dct.setdefault(comment.lineno, [])
lst.append(comment)
return _TableRowGenerator(old_patch, old_dict, len(old_lines)+1, 'new',
new_patch, new_dict, len(new_lines)+1, 'new',
_GenerateTriples(old_lines, new_lines),
colwidth, debug, request)
def _GenerateTriples(old_lines, new_lines):
"""Helper for _RenderDiff2TableRows yielding input for _TableRowGenerator.
Args:
old_lines: List of lines representing the patched file on the left.
new_lines: List of lines representing the patched file on the right.
Yields:
Tuples (tag, old_slice, new_slice) where tag is a tag as returned by
difflib.SequenceMatchser.get_opcodes(), and old_slice and new_slice
are lists of lines taken from old_lines and new_lines.
"""
sm = difflib.SequenceMatcher(None, old_lines, new_lines)
for tag, i1, i2, j1, j2 in sm.get_opcodes():
yield tag, old_lines[i1:i2], new_lines[j1:j2]
def _GetComments(request):
"""Helper that returns comments for a patch.
Args:
request: Django Request object.
Returns:
A 2-tuple of (old, new) where old/new are dictionaries that holds comments
for that file, mapping from line number to a Comment entity.
"""
old_dict = {}
new_dict = {}
# XXX GQL doesn't support OR yet... Otherwise we'd be using
# .gql('WHERE patch = :1 AND (draft = FALSE OR author = :2) ORDER BY data',
# patch, request.user)
for comment in models.Comment.gql('WHERE patch = :1 ORDER BY date',
request.patch):
if comment.draft and comment.author != request.user:
continue # Only show your own drafts
comment.complete()
if comment.left:
dct = old_dict
else:
dct = new_dict
dct.setdefault(comment.lineno, []).append(comment)
return old_dict, new_dict
def _RenderDiffTableRows(request, old_lines, chunks, patch,
colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False):
"""Internal version of RenderDiffTableRows().
Args:
The same as for RenderDiffTableRows.
Yields:
Tuples (tag, row) where tag is an indication of the row type.
"""
old_dict = {}
new_dict = {}
if patch:
old_dict, new_dict = _GetComments(request)
old_max, new_max = _ComputeLineCounts(old_lines, chunks)
return _TableRowGenerator(patch, old_dict, old_max, 'old',
patch, new_dict, new_max, 'new',
patching.PatchChunks(old_lines, chunks),
colwidth, debug, request)
def _TableRowGenerator(old_patch, old_dict, old_max, old_snapshot,
new_patch, new_dict, new_max, new_snapshot,
triple_iterator, colwidth=settings.DEFAULT_COLUMN_WIDTH,
debug=False, request=None):
"""Helper function to render side-by-side table rows.
Args:
old_patch: First models.Patch instance.
old_dict: Dictionary with line numbers as keys and comments as values (left)
old_max: Line count of the patch on the left.
old_snapshot: A tag used in the comments form.
new_patch: Second models.Patch instance.
new_dict: Same as old_dict, but for the right side.
new_max: Line count of the patch on the right.
new_snapshot: A tag used in the comments form.
triple_iterator: Iterator that yields (tag, old, new) triples.
colwidth: Optional column width (default 80).
debug: Optional debugging flag (default False).
Yields:
Tuples (tag, row) where tag is an indication of the row type and
row is an HTML fragment representing one or more <td> elements.
"""
diff_params = intra_region_diff.GetDiffParams(dbg=debug)
ndigits = 1 + max(len(str(old_max)), len(str(new_max)))
indent = 1 + ndigits
old_offset = new_offset = 0
row_count = 0
# Render a row with a message if a side is empty or both sides are equal.
if old_patch == new_patch and (old_max == 0 or new_max == 0):
if old_max == 0:
msg_old = '(Empty)'
else:
msg_old = ''
if new_max == 0:
msg_new = '(Empty)'
else:
msg_new = ''
yield '', ('<tr><td class="info">%s</td>'
'<td class="info">%s</td></tr>' % (msg_old, msg_new))
elif old_patch is None or new_patch is None:
msg_old = msg_new = ''
if old_patch is None:
msg_old = '(no file at all)'
if new_patch is None:
msg_new = '(no file at all)'
yield '', ('<tr><td class="info">%s</td>'
'<td class="info">%s</td></tr>' % (msg_old, msg_new))
elif old_patch != new_patch and old_patch.lines == new_patch.lines:
yield '', ('<tr><td class="info" colspan="2">'
'(Both sides are equal)</td></tr>')
for tag, old, new in triple_iterator:
if tag.startswith('error'):
yield 'error', '<tr><td><h3>%s</h3></td></tr>\n' % cgi.escape(tag)
return
old1 = old_offset
old_offset = old2 = old1 + len(old)
new1 = new_offset
new_offset = new2 = new1 + len(new)
old_buff = []
new_buff = []
frag_list = []
do_ir_diff = tag == 'replace' and intra_region_diff.CanDoIRDiff(old, new)
for i in xrange(max(len(old), len(new))):
row_count += 1
old_lineno = old1 + i + 1
new_lineno = new1 + i + 1
old_valid = old1+i < old2
new_valid = new1+i < new2
# Start rendering the first row
frags = []
if i == 0 and tag != 'equal':
# Mark the first row of each non-equal chunk as a 'hook'.
frags.append('<tr name="hook"')
else:
frags.append('<tr')
frags.append(' id="pair-%d">' % row_count)
old_intra_diff = ''
new_intra_diff = ''
if old_valid:
old_intra_diff = old[i]
if new_valid:
new_intra_diff = new[i]
frag_list.append(frags)
if do_ir_diff:
# Don't render yet. Keep saving state necessary to render the whole
# region until we have encountered all the lines in the region.
old_buff.append([old_valid, old_lineno, old_intra_diff])
new_buff.append([new_valid, new_lineno, new_intra_diff])
else:
# We render line by line as usual if do_ir_diff is false
old_intra_diff = intra_region_diff.Break(
old_intra_diff, 0, colwidth, "\n" + " "*indent)
new_intra_diff = intra_region_diff.Break(
new_intra_diff, 0, colwidth, "\n" + " "*indent)
old_buff_out = [[old_valid, old_lineno,
(old_intra_diff, True, None)]]
new_buff_out = [[new_valid, new_lineno,
(new_intra_diff, True, None)]]
for tg, frag in _RenderDiffInternal(old_buff_out, new_buff_out,
ndigits, tag, frag_list,
do_ir_diff,
old_dict, new_dict,
old_patch, new_patch,
old_snapshot, new_snapshot,
debug, request):
yield tg, frag
frag_list = []
if do_ir_diff:
# So this was a replace block which means that the whole region still
# needs to be rendered.
old_lines = [b[2] for b in old_buff]
new_lines = [b[2] for b in new_buff]
ret = intra_region_diff.IntraRegionDiff(old_lines, new_lines,
diff_params)
old_chunks, new_chunks, ratio = ret
old_tag = 'old'
new_tag = 'new'
old_diff_out = intra_region_diff.RenderIntraRegionDiff(
old_lines, old_chunks, old_tag, ratio,
limit=colwidth, indent=indent, mark_tabs=True,
dbg=debug)
new_diff_out = intra_region_diff.RenderIntraRegionDiff(
new_lines, new_chunks, new_tag, ratio,
limit=colwidth, indent=indent, mark_tabs=True,
dbg=debug)
for (i, b) in enumerate(old_buff):
b[2] = old_diff_out[i]
for (i, b) in enumerate(new_buff):
b[2] = new_diff_out[i]
for tg, frag in _RenderDiffInternal(old_buff, new_buff,
ndigits, tag, frag_list,
do_ir_diff,
old_dict, new_dict,
old_patch, new_patch,
old_snapshot, new_snapshot,
debug, request):
yield tg, frag
old_buff = []
new_buff = []
def _RenderDiffInternal(old_buff, new_buff, ndigits, tag, frag_list,
do_ir_diff, old_dict, new_dict,
old_patch, new_patch,
old_snapshot, new_snapshot,
debug, request):
"""Helper for _TableRowGenerator()."""
obegin = (intra_region_diff.BEGIN_TAG %
intra_region_diff.COLOR_SCHEME['old']['match'])
nbegin = (intra_region_diff.BEGIN_TAG %
intra_region_diff.COLOR_SCHEME['new']['match'])
oend = intra_region_diff.END_TAG
nend = oend
user = users.get_current_user()
for i in xrange(len(old_buff)):
tg = tag
old_valid, old_lineno, old_out = old_buff[i]
new_valid, new_lineno, new_out = new_buff[i]
old_intra_diff, old_has_newline, old_debug_info = old_out
new_intra_diff, new_has_newline, new_debug_info = new_out
frags = frag_list[i]
# Render left text column
frags.append(_RenderDiffColumn(old_valid, tag, ndigits,
old_lineno, obegin, oend, old_intra_diff,
do_ir_diff, old_has_newline, 'old'))
# Render right text column
frags.append(_RenderDiffColumn(new_valid, tag, ndigits,
new_lineno, nbegin, nend, new_intra_diff,
do_ir_diff, new_has_newline, 'new'))
# End rendering the first row
frags.append('</tr>\n')
if debug:
frags.append('<tr>')
if old_debug_info:
frags.append('<td class="debug-info">%s</td>' %
old_debug_info.replace('\n', '<br>'))
else:
frags.append('<td></td>')
if new_debug_info:
frags.append('<td class="debug-info">%s</td>' %
new_debug_info.replace('\n', '<br>'))
else:
frags.append('<td></td>')
frags.append('</tr>\n')
if old_patch or new_patch:
# Start rendering the second row
if ((old_valid and old_lineno in old_dict) or
(new_valid and new_lineno in new_dict)):
tg += '_comment'
frags.append('<tr class="inline-comments" name="hook">')
else:
frags.append('<tr class="inline-comments">')
# Render left inline comments
frags.append(_RenderInlineComments(old_valid, old_lineno, old_dict,
user, old_patch, old_snapshot, 'old',
request))
# Render right inline comments
frags.append(_RenderInlineComments(new_valid, new_lineno, new_dict,
user, new_patch, new_snapshot, 'new',
request))
# End rendering the second row
frags.append('</tr>\n')
# Yield the combined fragments
yield tg, ''.join(frags)
def _RenderDiffColumn(line_valid, tag, ndigits, lineno, begin, end,
intra_diff, do_ir_diff, has_newline, prefix):
"""Helper function for _RenderDiffInternal().
Returns:
A rendered column.
"""
if line_valid:
cls_attr = '%s%s' % (prefix, tag)
if tag == 'equal':
lno = '%*d' % (ndigits, lineno)
else:
lno = _MarkupNumber(ndigits, lineno, 'u')
if tag == 'replace':
col_content = ('%s%s %s%s' % (begin, lno, end, intra_diff))
# If IR diff has been turned off or there is no matching new line at
# the end then switch to dark background CSS style.
if not do_ir_diff or not has_newline:
cls_attr = cls_attr + '1'
else:
col_content = '%s %s' % (lno, intra_diff)
return '<td class="%s" id="%scode%d">%s</td>' % (cls_attr, prefix,
lineno, col_content)
else:
return '<td class="%sblank"></td>' % prefix
def _RenderInlineComments(line_valid, lineno, data, user,
patch, snapshot, prefix, request):
"""Helper function for _RenderDiffInternal().
Returns:
Rendered comments.
"""
comments = []
if line_valid:
comments.append('<td id="%s-line-%s">' % (prefix, lineno))
if lineno in data:
comments.append(
_ExpandTemplate('inline_comment.html',
request,
user=user,
patch=patch,
patchset=patch.patchset,
issue=patch.patchset.issue,
snapshot=snapshot,
side='a' if prefix == 'old' else 'b',
comments=data[lineno],
lineno=lineno,
))
comments.append('</td>')
else:
comments.append('<td></td>')
return ''.join(comments)
def RenderUnifiedTableRows(request, parsed_lines):
"""Render the HTML table rows for a unified diff for a patch.
Args:
request: Django Request object.
parsed_lines: List of tuples for each line that contain the line number,
if they exist, for the old and new file.
Returns:
A list of html table rows.
"""
old_dict, new_dict = _GetComments(request)
rows = []
for old_line_no, new_line_no, line_text in parsed_lines:
row1_id = row2_id = ''
# When a line is unchanged (i.e. both old_line_no and new_line_no aren't 0)
# pick the old column line numbers when adding a comment.
if old_line_no:
row1_id = 'id="oldcode%d"' % old_line_no
row2_id = 'id="old-line-%d"' % old_line_no
elif new_line_no:
row1_id = 'id="newcode%d"' % new_line_no
row2_id = 'id="new-line-%d"' % new_line_no
if line_text[0] == '+':
style = 'udiffadd'
elif line_text[0] == '-':
style = 'udiffremove'
else:
style = ''
rows.append('<tr><td class="udiff %s" %s>%s</td></tr>' %
(style, row1_id, cgi.escape(line_text)))
frags = []
if old_line_no in old_dict or new_line_no in new_dict:
frags.append('<tr class="inline-comments" name="hook">')
if old_line_no in old_dict:
dct = old_dict
line_no = old_line_no
snapshot = 'old'
else:
dct = new_dict
line_no = new_line_no
snapshot = 'new'
frags.append(_RenderInlineComments(True, line_no, dct, request.user,
request.patch, snapshot, snapshot, request))
else:
frags.append('<tr class="inline-comments">')
frags.append('<td ' + row2_id +'></td>')
frags.append('</tr>')
rows.append(''.join(frags))
return rows
def _ComputeLineCounts(old_lines, chunks):
"""Compute the length of the old and new sides of a diff.
Args:
old_lines: List of lines representing the original file.
chunks: List of chunks as returned by patching.ParsePatchToChunks().
Returns:
A tuple (old_len, new_len) representing len(old_lines) and
len(new_lines), where new_lines is the list representing the
result of applying the patch chunks to old_lines, however, without
actually computing new_lines.
"""
old_len = len(old_lines)
new_len = old_len
if chunks:
(_, old_b), (_, new_b), old_lines, _ = chunks[-1]
new_len += new_b - old_b
return old_len, new_len
def _MarkupNumber(ndigits, number, tag):
"""Format a number in HTML in a given width with extra markup.
Args:
ndigits: the total width available for formatting
number: the number to be formatted
tag: HTML tag name, e.g. 'u'
Returns:
An HTML string that displays as ndigits wide, with the
number right-aligned and surrounded by an HTML tag; for example,
_MarkupNumber(42, 4, 'u') returns ' <u>42</u>'.
"""
formatted_number = str(number)
space_prefix = ' ' * (ndigits - len(formatted_number))
return '%s<%s>%s</%s>' % (space_prefix, tag, formatted_number, tag)
def _ExpandTemplate(name, request, **params):
"""Wrapper around django.template.loader.render_to_string().
For convenience, this takes keyword arguments instead of a dict.
"""
rslt = loader.render_to_string(name, params,
context_instance=RequestContext(request))
return rslt.encode('utf-8')
| ajibawa-2023/Python-Code-Large/train/row_1191 | 311 | 702 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L15_C0", "label": "expression", "type": "expression", "loc": [15, 15], "level": 0, "parent": null, "vector": [8, 0, 0.0214, 0.0014, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Diff rendering in HTML for Rietveld.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Import_L17_C0", "label": "cgi import cgi", "type": "import", "loc": [17, 17], "level": 0, "parent": null, "vector": [1, 0, 0.0242, 0.0014, 0, 0.66, 0.0357, 934, 0, 1, 0, 0, 934, 0, 0], "semantic": {"name": "cgi", "arg_names": [], "import_names": ["cgi"], "rhs_call_name": "", "annotation": ""}, "snippet": "import cgi"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Import_L18_C0", "label": "difflib import difflib", "type": "import", "loc": [18, 18], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0014, 0, 0.66, 0.0714, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "difflib", "arg_names": [], "import_names": ["difflib"], "rhs_call_name": "", "annotation": ""}, "snippet": "import difflib"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Import_L19_C0", "label": "re import re", "type": "import", "loc": [19, 19], "level": 0, "parent": null, "vector": [1, 0, 0.0271, 0.0014, 0, 0.66, 0.1071, 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_1191:ImportFrom_L21_C0", "label": "from google.appengine.api import users", "type": "import", "loc": [21, 21], "level": 0, "parent": null, "vector": [1, 0, 0.0299, 0.0014, 0, 0.66, 0.1429, 279, 0, 1, 0, 0, 279, 0, 0], "semantic": {"name": "google.appengine.api", "arg_names": [], "import_names": ["users"], "rhs_call_name": "", "annotation": ""}, "snippet": "from google.appengine.api import users"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:ImportFrom_L23_C0", "label": "from django.conf import settings", "type": "import", "loc": [23, 23], "level": 0, "parent": null, "vector": [1, 0, 0.0328, 0.0014, 0, 0.66, 0.1786, 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_1191:ImportFrom_L24_C0", "label": "from django.template import loader, RequestContext", "type": "import", "loc": [24, 24], "level": 0, "parent": null, "vector": [1, 0, 0.0342, 0.0014, 0, 0.66, 0.2143, 213, 0, 2, 0, 0, 213, 0, 0], "semantic": {"name": "django.template", "arg_names": [], "import_names": ["loader", "RequestContext"], "rhs_call_name": "", "annotation": ""}, "snippet": "from django.template import loader, RequestContext"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:ImportFrom_L26_C0", "label": "from codereview import intra_region_diff", "type": "import", "loc": [26, 26], "level": 0, "parent": null, "vector": [1, 0, 0.037, 0.0014, 0, 0.66, 0.25, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["intra_region_diff"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import intra_region_diff"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:ImportFrom_L27_C0", "label": "from codereview import models", "type": "import", "loc": [27, 27], "level": 0, "parent": null, "vector": [1, 0, 0.0385, 0.0014, 0, 0.66, 0.2857, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["models"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import models"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:ImportFrom_L28_C0", "label": "from codereview import patching", "type": "import", "loc": [28, 28], "level": 0, "parent": null, "vector": [1, 0, 0.0399, 0.0014, 0, 0.66, 0.3214, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["patching"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import patching"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:ImportFrom_L29_C0", "label": "from codereview import utils", "type": "import", "loc": [29, 29], "level": 0, "parent": null, "vector": [1, 0, 0.0413, 0.0014, 0, 0.66, 0.3571, 844, 0, 1, 0, 0, 844, 0, 0], "semantic": {"name": "codereview", "arg_names": [], "import_names": ["utils"], "rhs_call_name": "", "annotation": ""}, "snippet": "from codereview import utils"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "label": "SplitPatch", "type": "function", "loc": [33, 70], "level": 0, "parent": null, "vector": [2, 0, 0.0734, 0.0541, 0, 0.66, 0.3929, 68, 0, 1, 1, 0, 0, 0, 13], "semantic": {"name": "SplitPatch", "arg_names": ["data"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def SplitPatch(data):\n \"\"\"Splits a patch into separate pieces for each file.\n\n Args:\n data: A string containing the output of svn diff.\n\n Returns:\n A list of 2-tuple (filename, text) where text is the svn diff output"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L34_C2", "label": "expression", "type": "expression", "loc": [34, 42], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [8, 1, 0.0541, 0.0128, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Splits a patch into separate pieces for each file.\n\n Args:\n data: A string containing the output of svn diff.\n\n Returns:\n A list of 2-tuple (filename, text) where text is the svn diff output\n pertaining to filename."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L43_C2", "label": "patches =", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [14, 1, 0.0613, 0.0014, 1, 0.7, 0.1667, 310, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "patches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " patches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L44_C2", "label": "filename =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [14, 1, 0.0627, 0.0014, 1, 0.7, 0.3333, 275, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L45_C2", "label": "diff =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [14, 1, 0.0641, 0.0014, 1, 0.7, 0.5, 833, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "label": "for line", "type": "for", "loc": [46, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [6, 1, 0.0805, 0.0313, 1, 0.7, 0.6667, 373, 3, 0, 0, 0, 0, 0, 11], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in data.splitlines(True):\n new_filename = None\n if line.startswith('Index:'):\n _, new_filename = line.split(':', 1)\n new_filename = new_filename.strip()\n elif line.startswith('Property changes on:'):\n _, temp_filename = line.split(':', 1)\n # When a file is modified, paths use '/' between directories, however"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L47_C4", "label": "new_filename =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "vector": [14, 2, 0.067, 0.0014, 2, 0.11, 0.0, 613, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "new_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_filename = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "label": "if", "type": "if", "loc": [48, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "vector": [4, 2, 0.0762, 0.0171, 2, 0.11, 0.3333, 0, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line.startswith('Index:'):\n _, new_filename = line.split(':', 1)\n new_filename = new_filename.strip()\n elif line.startswith('Property changes on:'):\n _, temp_filename = line.split(':', 1)\n # When a file is modified, paths use '/' between directories, however\n # when a property is modified '\\' is used on Windows. Make them the same\n # otherwise the file shows up twice."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L49_C6", "label": "_, new_filename = split()", "type": "assigned_variable", "loc": [49, 49], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "vector": [14, 3, 0.0698, 0.0014, 3, 0.14, 0.0, 603, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "_, new_filename", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " _, new_filename = line.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L50_C6", "label": "new_filename = strip()", "type": "assigned_variable", "loc": [50, 50], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "vector": [14, 3, 0.0712, 0.0014, 3, 0.14, 0.5, 613, 3, 0, 0, 0, 973, 10, 1], "semantic": {"name": "new_filename", "arg_names": [], "import_names": [], "rhs_call_name": "strip", "annotation": ""}, "snippet": " new_filename = new_filename.strip()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "label": "if", "type": "if", "loc": [51, 59], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "vector": [4, 3, 0.0783, 0.0128, 3, 0.14, 1.0, 0, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line.startswith('Property changes on:'):\n _, temp_filename = line.split(':', 1)\n # When a file is modified, paths use '/' between directories, however\n # when a property is modified '\\' is used on Windows. Make them the same\n # otherwise the file shows up twice.\n temp_filename = temp_filename.strip().replace('\\\\', '/')\n if temp_filename != filename:\n # File has property changes but no modifications, create a new diff."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L52_C6", "label": "_, temp_filename = split()", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "vector": [14, 4, 0.0741, 0.0014, 4, 0.45, 0.0, 691, 3, 2, 0, 0, 908, 10, 1], "semantic": {"name": "_, temp_filename", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " _, temp_filename = line.split(':', 1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L56_C6", "label": "temp_filename = replace()", "type": "assigned_variable", "loc": [56, 56], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "vector": [14, 4, 0.0798, 0.0014, 4, 0.45, 0.5, 747, 3, 2, 0, 0, 293, 10, 2], "semantic": {"name": "temp_filename", "arg_names": [], "import_names": [], "rhs_call_name": "replace", "annotation": ""}, "snippet": " temp_filename = temp_filename.strip().replace('\\\\', '/')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L57_C6", "label": "if", "type": "if", "loc": [57, 59], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "vector": [4, 4, 0.0826, 0.0043, 4, 0.45, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if temp_filename != filename:\n # File has property changes but no modifications, create a new diff.\n new_filename = temp_filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L59_C8", "label": "new_filename =", "type": "assigned_variable", "loc": [59, 59], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L57_C6", "vector": [14, 5, 0.084, 0.0014, 5, 0.4, 0.0, 613, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_filename = temp_filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "label": "if", "type": "if", "loc": [60, 65], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "vector": [4, 2, 0.089, 0.0085, 2, 0.11, 0.6667, 0, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_filename:\n if filename and diff:\n patches.append((filename, ''.join(diff)))\n filename = new_filename\n diff = [line]\n continue"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L61_C6", "label": "if", "type": "if", "loc": [61, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "vector": [4, 3, 0.0876, 0.0028, 3, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename and diff:\n patches.append((filename, ''.join(diff)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L62_C8", "label": "append()", "type": "expression", "loc": [62, 62], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L61_C6", "vector": [8, 4, 0.0883, 0.0014, 4, 0.9, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " patches.append((filename, ''.join(diff)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L63_C6", "label": "filename =", "type": "assigned_variable", "loc": [63, 63], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "vector": [14, 3, 0.0897, 0.0014, 3, 0.73, 0.5, 275, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = new_filename"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L64_C6", "label": "diff =", "type": "assigned_variable", "loc": [64, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "vector": [14, 3, 0.0912, 0.0014, 3, 0.73, 1.0, 833, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " diff = [line]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L66_C4", "label": "if", "type": "if", "loc": [66, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "vector": [4, 2, 0.0947, 0.0028, 2, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if diff is not None:\n diff.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L67_C6", "label": "append()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L66_C4", "vector": [8, 3, 0.0954, 0.0014, 3, 0.35, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " diff.append(line)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L68_C2", "label": "if", "type": "if", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [4, 1, 0.0976, 0.0028, 1, 0.7, 0.8333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if filename and diff:\n patches.append((filename, ''.join(diff)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L69_C4", "label": "append()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L68_C2", "vector": [8, 2, 0.0983, 0.0014, 2, 0.8, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " patches.append((filename, ''.join(diff)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "vector": [13, 1, 0.0997, 0.0014, 1, 0.7, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return patches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "label": "ParsePatchSet", "type": "function", "loc": [73, 86], "level": 0, "parent": null, "vector": [2, 0, 0.1132, 0.0199, 0, 0.66, 0.4286, 499, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "ParsePatchSet", "arg_names": ["patchset"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def ParsePatchSet(patchset):\n \"\"\"Patch a patch set into individual patches.\n\n Args:\n patchset: a models.PatchSet instance.\n\n Returns:\n A list of models.Patch instances."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L74_C2", "label": "expression", "type": "expression", "loc": [74, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "vector": [8, 1, 0.1104, 0.0114, 1, 0.71, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Patch a patch set into individual patches.\n\n Args:\n patchset: a models.PatchSet instance.\n\n Returns:\n A list of models.Patch instances.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L82_C2", "label": "patches =", "type": "assigned_variable", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "vector": [14, 1, 0.1168, 0.0014, 1, 0.71, 0.3333, 310, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "patches", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " patches = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L83_C2", "label": "for filename, text", "type": "for", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "vector": [6, 1, 0.1197, 0.0043, 1, 0.71, 0.6667, 365, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "filename, text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for filename, text in SplitPatch(patchset.data):\n patches.append(models.Patch(patchset=patchset, text=utils.to_dbtext(text),\n filename=filename, parent=patchset))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L84_C4", "label": "append()", "type": "expression", "loc": [84, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L83_C2", "vector": [8, 2, 0.1204, 0.0028, 2, 0.73, 0.0, 243, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " patches.append(models.Patch(patchset=patchset, text=utils.to_dbtext(text),\n filename=filename, parent=patchset))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L86_C2", "label": "return", "type": "return", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "vector": [13, 1, 0.1225, 0.0014, 1, 0.71, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return patches"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "label": "RenderDiffTableRows", "type": "function", "loc": [89, 110], "level": 0, "parent": null, "vector": [2, 0, 0.1417, 0.0313, 0, 0.66, 0.4643, 612, 0, 7, 1, 0, 0, 0, 2], "semantic": {"name": "RenderDiffTableRows", "arg_names": ["request", "old_lines", "chunks", "patch", "colwidth", "debug", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RenderDiffTableRows(request, old_lines, chunks, patch,\n colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False,\n context=settings.DEFAULT_CONTEXT):\n \"\"\"Render the HTML table rows for a side-by-side diff for a patch.\n\n Args:\n request: Django Request object.\n old_lines: List of lines representing the original file."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L92_C2", "label": "expression", "type": "expression", "loc": [92, 107], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "vector": [8, 1, 0.1417, 0.0228, 1, 0.65, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render the HTML table rows for a side-by-side diff for a patch.\n\n Args:\n request: Django Request object.\n old_lines: List of lines representing the original file.\n chunks: List of chunks as returned by patching.ParsePatchToChunks().\n patch: A models.Patch instance.\n colwidth: Optional column width (default 80)."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L108_C2", "label": "rows = _RenderDiffTableRows()", "type": "assigned_variable", "loc": [108, 109], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "vector": [14, 1, 0.1546, 0.0028, 1, 0.65, 0.5, 275, 3, 6, 0, 0, 504, 10, 1], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "_RenderDiffTableRows", "annotation": ""}, "snippet": " rows = _RenderDiffTableRows(request, old_lines, chunks, patch,\n colwidth, debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L110_C2", "label": "return", "type": "return", "loc": [110, 110], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "vector": [13, 1, 0.1567, 0.0014, 1, 0.65, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _CleanupTableRowsGenerator(rows, context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "label": "RenderDiff2TableRows", "type": "function", "loc": [113, 136], "level": 0, "parent": null, "vector": [2, 0, 0.1774, 0.0342, 0, 0.66, 0.5, 855, 0, 8, 1, 0, 0, 0, 2], "semantic": {"name": "RenderDiff2TableRows", "arg_names": ["request", "old_lines", "old_patch", "new_lines", "new_patch", "colwidth", "debug", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RenderDiff2TableRows(request, old_lines, old_patch, new_lines, new_patch,\n colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False,\n context=settings.DEFAULT_CONTEXT):\n \"\"\"Render the HTML table rows for a side-by-side diff between two patches.\n\n Args:\n request: Django Request object.\n old_lines: List of lines representing the patched file on the left."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L116_C2", "label": "expression", "type": "expression", "loc": [116, 133], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "vector": [8, 1, 0.1774, 0.0256, 1, 0.9, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render the HTML table rows for a side-by-side diff between two patches.\n\n Args:\n request: Django Request object.\n old_lines: List of lines representing the patched file on the left.\n old_patch: The models.Patch instance corresponding to old_lines.\n new_lines: List of lines representing the patched file on the right.\n new_patch: The models.Patch instance corresponding to new_lines."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L134_C2", "label": "rows = _RenderDiff2TableRows()", "type": "assigned_variable", "loc": [134, 135], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "vector": [14, 1, 0.1916, 0.0028, 1, 0.9, 0.5, 275, 3, 7, 0, 0, 814, 10, 1], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "_RenderDiff2TableRows", "annotation": ""}, "snippet": " rows = _RenderDiff2TableRows(request, old_lines, old_patch,\n new_lines, new_patch, colwidth, debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L136_C2", "label": "return", "type": "return", "loc": [136, 136], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "vector": [13, 1, 0.1937, 0.0014, 1, 0.9, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _CleanupTableRowsGenerator(rows, context)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "label": "_CleanupTableRowsGenerator", "type": "function", "loc": [139, 165], "level": 0, "parent": null, "vector": [2, 0, 0.2165, 0.0385, 0, 0.66, 0.5357, 903, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "_CleanupTableRowsGenerator", "arg_names": ["rows", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _CleanupTableRowsGenerator(rows, context):\n \"\"\"Cleanup rows returned by _TableRowGenerator for output.\n\n Args:\n rows: List of tuples (tag, text)\n context: Maximum number of visible context lines.\n\n Yields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L140_C2", "label": "expression", "type": "expression", "loc": [140, 149], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "vector": [8, 1, 0.2058, 0.0142, 1, 0.26, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Cleanup rows returned by _TableRowGenerator for output.\n\n Args:\n rows: List of tuples (tag, text)\n context: Maximum number of visible context lines.\n\n Yields:\n Rows marked as 'equal' are possibly contracted using _ShortenBuffer()."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L150_C2", "label": "buffer =", "type": "assigned_variable", "loc": [150, 150], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "vector": [14, 1, 0.2137, 0.0014, 1, 0.26, 0.3333, 640, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "label": "for tag, text", "type": "for", "loc": [151, 162], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "vector": [6, 1, 0.2229, 0.0171, 1, 0.26, 0.6667, 308, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "tag, text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, text in rows:\n if tag == 'equal':\n buffer.append(text)\n continue\n else:\n for t in _ShortenBuffer(buffer, context):\n yield t\n buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "label": "if", "type": "if", "loc": [152, 158], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "vector": [4, 2, 0.2208, 0.01, 2, 0.74, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'equal':\n buffer.append(text)\n continue\n else:\n for t in _ShortenBuffer(buffer, context):\n yield t\n buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L153_C6", "label": "append()", "type": "expression", "loc": [153, 153], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "vector": [8, 3, 0.2179, 0.0014, 3, 0.74, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " buffer.append(text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L156_C6", "label": "for t", "type": "for", "loc": [156, 157], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "vector": [6, 3, 0.2229, 0.0028, 3, 0.74, 0.5, 15, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in _ShortenBuffer(buffer, context):\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L157_C8", "label": "expression", "type": "expression", "loc": [157, 157], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L156_C6", "vector": [8, 4, 0.2236, 0.0014, 4, 0.85, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L158_C6", "label": "buffer =", "type": "assigned_variable", "loc": [158, 158], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "vector": [14, 3, 0.2251, 0.0014, 3, 0.74, 1.0, 640, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "buffer", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buffer = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L159_C4", "label": "expression", "type": "expression", "loc": [159, 159], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "vector": [8, 2, 0.2265, 0.0014, 2, 0.74, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield text"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L160_C4", "label": "if", "type": "if", "loc": [160, 162], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "vector": [4, 2, 0.2293, 0.0043, 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 tag == 'error':\n yield None\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L161_C6", "label": "expression", "type": "expression", "loc": [161, 161], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L160_C4", "vector": [8, 3, 0.2293, 0.0014, 3, 0.67, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L163_C2", "label": "if", "type": "if", "loc": [163, 165], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "vector": [4, 1, 0.2336, 0.0043, 1, 0.26, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if buffer:\n for t in _ShortenBuffer(buffer, context):\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L164_C4", "label": "for t", "type": "for", "loc": [164, 165], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L163_C2", "vector": [6, 2, 0.2343, 0.0028, 2, 0.01, 0.0, 15, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in _ShortenBuffer(buffer, context):\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L165_C6", "label": "expression", "type": "expression", "loc": [165, 165], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L164_C4", "vector": [8, 3, 0.235, 0.0014, 3, 0.54, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L168_C0", "label": "_ShortenBuffer", "type": "function", "loc": [168, 220], "level": 0, "parent": null, "vector": [2, 0, 0.2764, 0.0755, 0, 0.66, 0.5714, 102, 0, 2, 0, 0, 0, 0, 11], "semantic": {"name": "_ShortenBuffer", "arg_names": ["buffer", "context"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _ShortenBuffer(buffer, context):\n \"\"\"Render a possibly contracted series of HTML table rows.\n\n Args:\n buffer: a list of strings representing HTML table rows.\n context: Maximum number of visible context lines. If None all lines are\n returned.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L169_C2", "label": "expression", "type": "expression", "loc": [169, 181], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L168_C0", "vector": [8, 1, 0.2493, 0.0185, 1, 0.09, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render a possibly contracted series of HTML table rows.\n\n Args:\n buffer: a list of strings representing HTML table rows.\n context: Maximum number of visible context lines. If None all lines are\n returned.\n\n Yields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "label": "if", "type": "if", "loc": [182, 220], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L168_C0", "vector": [4, 1, 0.2863, 0.0556, 1, 0.09, 1.0, 0, 0, 0, 0, 0, 0, 0, 11], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if context is None or len(buffer) < 3*context:\n for t in buffer:\n yield t\n else:\n last_id = None\n for t in buffer[:context]:\n m = re.match('^<tr( name=\"hook\")? id=\"pair-(?P<rowcount>\\d+)\">', t)\n if m:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L183_C4", "label": "for t", "type": "for", "loc": [183, 184], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [6, 2, 0.2614, 0.0028, 2, 0.27, 0.0, 15, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in buffer:\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L184_C6", "label": "expression", "type": "expression", "loc": [184, 184], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L183_C4", "vector": [8, 3, 0.2621, 0.0014, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L186_C4", "label": "last_id =", "type": "assigned_variable", "loc": [186, 186], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [14, 2, 0.265, 0.0014, 2, 0.27, 0.1, 699, 1, 0, 0, 0, 0, 9, 0], "semantic": {"name": "last_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last_id = None"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "label": "for t", "type": "for", "loc": [187, 191], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [6, 2, 0.2692, 0.0071, 2, 0.27, 0.2, 15, 6, 0, 0, 0, 0, 0, 4], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in buffer[:context]:\n m = re.match('^<tr( name=\"hook\")? id=\"pair-(?P<rowcount>\\d+)\">', t)\n if m:\n last_id = int(m.groupdict().get(\"rowcount\"))\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L188_C6", "label": "m = match()", "type": "assigned_variable", "loc": [188, 188], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "vector": [14, 3, 0.2678, 0.0014, 3, 0.2, 0.0, 711, 3, 2, 0, 0, 36, 10, 1], "semantic": {"name": "m", "arg_names": [], "import_names": [], "rhs_call_name": "match", "annotation": ""}, "snippet": " m = re.match('^<tr( name=\"hook\")? id=\"pair-(?P<rowcount>\\d+)\">', t)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L189_C6", "label": "if", "type": "if", "loc": [189, 190], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "vector": [4, 3, 0.2699, 0.0028, 3, 0.2, 0.5, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if m:\n last_id = int(m.groupdict().get(\"rowcount\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L190_C8", "label": "last_id = int()", "type": "assigned_variable", "loc": [190, 190], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L189_C6", "vector": [14, 4, 0.2707, 0.0014, 4, 0.86, 0.0, 699, 3, 1, 0, 0, 901, 10, 3], "semantic": {"name": "last_id", "arg_names": [], "import_names": [], "rhs_call_name": "int", "annotation": ""}, "snippet": " last_id = int(m.groupdict().get(\"rowcount\"))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L191_C6", "label": "expression", "type": "expression", "loc": [191, 191], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "vector": [8, 3, 0.2721, 0.0014, 3, 0.2, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L192_C4", "label": "skip =", "type": "assigned_variable", "loc": [192, 192], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [14, 2, 0.2735, 0.0014, 2, 0.27, 0.3, 171, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "skip", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " skip = len(buffer) - 2*context"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L193_C4", "label": "expand_link =", "type": "assigned_variable", "loc": [193, 193], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [14, 2, 0.2749, 0.0014, 2, 0.27, 0.4, 961, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "expand_link", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expand_link = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L194_C4", "label": "if", "type": "if", "loc": [194, 198], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [4, 2, 0.2792, 0.0071, 2, 0.27, 0.5, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if skip > 3*context:\n expand_link.append(('<a href=\"javascript:M_expandSkipped(%(before)d, '\n '%(after)d, \\'t\\', %(skip)d)\">'\n 'Expand %(context)d before'\n '</a> | '))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L195_C6", "label": "append()", "type": "expression", "loc": [195, 198], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L194_C4", "vector": [8, 3, 0.2799, 0.0057, 3, 0.67, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " expand_link.append(('<a href=\"javascript:M_expandSkipped(%(before)d, '\n '%(after)d, \\'t\\', %(skip)d)\">'\n 'Expand %(context)d before'\n '</a> | '))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L199_C4", "label": "append()", "type": "expression", "loc": [199, 200], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [8, 2, 0.2842, 0.0028, 2, 0.27, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " expand_link.append(('<a href=\"javascript:M_expandSkipped(%(before)d, '\n '%(after)d, \\'a\\', %(skip)d)\">Expand all</a>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L201_C4", "label": "if", "type": "if", "loc": [201, 206], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [4, 2, 0.2899, 0.0085, 2, 0.27, 0.7, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if skip > 3*context:\n expand_link.append((' | '\n '<a href=\"javascript:M_expandSkipped(%(before)d, '\n '%(after)d, \\'b\\', %(skip)d)\">'\n 'Expand %(context)d after'\n '</a>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L202_C6", "label": "append()", "type": "expression", "loc": [202, 206], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L201_C4", "vector": [8, 3, 0.2906, 0.0071, 3, 0.2, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " expand_link.append((' | '\n '<a href=\"javascript:M_expandSkipped(%(before)d, '\n '%(after)d, \\'b\\', %(skip)d)\">'\n 'Expand %(context)d after'\n '</a>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L207_C4", "label": "expand_link =", "type": "assigned_variable", "loc": [207, 210], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [14, 2, 0.297, 0.0057, 2, 0.27, 0.8, 961, 4, 0, 0, 0, 0, 0, 2], "semantic": {"name": "expand_link", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " expand_link = ''.join(expand_link) % {'before': last_id+1,\n 'after': last_id+skip,\n 'skip': last_id,\n 'context': max(context, None)}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L211_C4", "label": "expression", "type": "expression", "loc": [211, 218], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [8, 2, 0.3056, 0.0114, 2, 0.27, 0.9, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield ('<tr id=\"skip-%d\"><td colspan=\"2\" align=\"center\" '\n 'style=\"background:lightblue\">'\n '(...skipping <span id=\"skipcount-%d\">%d</span> matching lines...) '\n '<span id=\"skiplinks-%d\">%s</span> '\n '<span id=\"skiploading-%d\" style=\"visibility:hidden;\">Loading...'\n '</span>'\n '</td></tr>\\n' % (last_id, last_id, skip,\n last_id, expand_link, last_id))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L219_C4", "label": "for t", "type": "for", "loc": [219, 220], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "vector": [6, 2, 0.3127, 0.0028, 2, 0.27, 1.0, 15, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "t", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for t in buffer[-context:]:\n yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L220_C6", "label": "expression", "type": "expression", "loc": [220, 220], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L219_C4", "vector": [8, 3, 0.3134, 0.0014, 3, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield t"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "label": "_RenderDiff2TableRows", "type": "function", "loc": [223, 247], "level": 0, "parent": null, "vector": [2, 0, 0.3348, 0.0356, 0, 0.66, 0.6071, 814, 0, 7, 1, 0, 0, 0, 8], "semantic": {"name": "_RenderDiff2TableRows", "arg_names": ["request", "old_lines", "old_patch", "new_lines", "new_patch", "colwidth", "debug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _RenderDiff2TableRows(request, old_lines, old_patch, new_lines, new_patch,\n colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False):\n \"\"\"Internal version of RenderDiff2TableRows().\n\n Args:\n The same as for RenderDiff2TableRows.\n\n Yields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L225_C2", "label": "expression", "type": "expression", "loc": [225, 232], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "vector": [8, 1, 0.3255, 0.0114, 1, 0.51, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Internal version of RenderDiff2TableRows().\n\n Args:\n The same as for RenderDiff2TableRows.\n\n Yields:\n Tuples (tag, row) where tag is an indication of the row type.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L233_C2", "label": "old_dict =", "type": "assigned_variable", "loc": [233, 233], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "vector": [14, 1, 0.3319, 0.0014, 1, 0.51, 0.25, 360, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "old_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L234_C2", "label": "new_dict =", "type": "assigned_variable", "loc": [234, 234], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "vector": [14, 1, 0.3333, 0.0014, 1, 0.51, 0.5, 631, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "new_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L235_C2", "label": "for patch, dct", "type": "for", "loc": [235, 243], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "vector": [6, 1, 0.3405, 0.0128, 1, 0.51, 0.75, 658, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "patch, dct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for patch, dct in [(old_patch, old_dict), (new_patch, new_dict)]:\n # XXX GQL doesn't support OR yet... Otherwise we'd be using that.\n for comment in models.Comment.gql(\n 'WHERE patch = :1 AND left = FALSE ORDER BY date', patch):\n if comment.draft and comment.author != request.user:\n continue # Only show your own drafts\n comment.complete()\n lst = dct.setdefault(comment.lineno, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "label": "for comment", "type": "for", "loc": [237, 243], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L235_C2", "vector": [6, 2, 0.3419, 0.01, 2, 0.43, 0.0, 34, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for comment in models.Comment.gql(\n 'WHERE patch = :1 AND left = FALSE ORDER BY date', patch):\n if comment.draft and comment.author != request.user:\n continue # Only show your own drafts\n comment.complete()\n lst = dct.setdefault(comment.lineno, [])\n lst.append(comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L239_C6", "label": "if", "type": "if", "loc": [239, 240], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "vector": [4, 3, 0.3412, 0.0028, 3, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment.draft and comment.author != request.user:\n continue # Only show your own drafts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L241_C6", "label": "complete()", "type": "expression", "loc": [241, 241], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "vector": [8, 3, 0.3433, 0.0014, 3, 0.5, 0.3333, 482, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "complete", "arg_names": [], "import_names": [], "rhs_call_name": "complete", "annotation": ""}, "snippet": " comment.complete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L242_C6", "label": "lst = setdefault()", "type": "assigned_variable", "loc": [242, 242], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "vector": [14, 3, 0.3447, 0.0014, 3, 0.5, 0.6667, 564, 3, 2, 0, 0, 262, 10, 1], "semantic": {"name": "lst", "arg_names": [], "import_names": [], "rhs_call_name": "setdefault", "annotation": ""}, "snippet": " lst = dct.setdefault(comment.lineno, [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L243_C6", "label": "append()", "type": "expression", "loc": [243, 243], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "vector": [8, 3, 0.3462, 0.0014, 3, 0.5, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " lst.append(comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L244_C2", "label": "return", "type": "return", "loc": [244, 247], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "vector": [13, 1, 0.3497, 0.0057, 1, 0.51, 1.0, 0, 3, 0, 0, 0, 0, 10, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _TableRowGenerator(old_patch, old_dict, len(old_lines)+1, 'new',\n new_patch, new_dict, len(new_lines)+1, 'new',\n _GenerateTriples(old_lines, new_lines),\n colwidth, debug, request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "label": "_GenerateTriples", "type": "function", "loc": [250, 264], "level": 0, "parent": null, "vector": [2, 0, 0.3661, 0.0214, 0, 0.66, 0.6429, 785, 0, 2, 0, 0, 0, 0, 2], "semantic": {"name": "_GenerateTriples", "arg_names": ["old_lines", "new_lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _GenerateTriples(old_lines, new_lines):\n \"\"\"Helper for _RenderDiff2TableRows yielding input for _TableRowGenerator.\n\n Args:\n old_lines: List of lines representing the patched file on the left.\n new_lines: List of lines representing the patched file on the right.\n\n Yields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L251_C2", "label": "expression", "type": "expression", "loc": [251, 261], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "vector": [8, 1, 0.3647, 0.0157, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper for _RenderDiff2TableRows yielding input for _TableRowGenerator.\n\n Args:\n old_lines: List of lines representing the patched file on the left.\n new_lines: List of lines representing the patched file on the right.\n\n Yields:\n Tuples (tag, old_slice, new_slice) where tag is a tag as returned by"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L262_C2", "label": "sm = SequenceMatcher()", "type": "assigned_variable", "loc": [262, 262], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "vector": [14, 1, 0.3732, 0.0014, 1, 0.76, 0.5, 21, 3, 3, 0, 0, 54, 10, 1], "semantic": {"name": "sm", "arg_names": [], "import_names": [], "rhs_call_name": "SequenceMatcher", "annotation": ""}, "snippet": " sm = difflib.SequenceMatcher(None, old_lines, new_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L263_C2", "label": "for tag, i1, i2, j1, j2", "type": "for", "loc": [263, 264], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "vector": [6, 1, 0.3754, 0.0028, 1, 0.76, 1.0, 429, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tag, i1, i2, j1, j2", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, i1, i2, j1, j2 in sm.get_opcodes():\n yield tag, old_lines[i1:i2], new_lines[j1:j2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L264_C4", "label": "expression", "type": "expression", "loc": [264, 264], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L263_C2", "vector": [8, 2, 0.3761, 0.0014, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield tag, old_lines[i1:i2], new_lines[j1:j2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "label": "_GetComments", "type": "function", "loc": [267, 292], "level": 0, "parent": null, "vector": [2, 0, 0.3981, 0.037, 0, 0.66, 0.6786, 815, 0, 1, 1, 0, 0, 0, 4], "semantic": {"name": "_GetComments", "arg_names": ["request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _GetComments(request):\n \"\"\"Helper that returns comments for a patch.\n\n Args:\n request: Django Request object.\n\n Returns:\n A 2-tuple of (old, new) where old/new are dictionaries that holds comments"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L268_C2", "label": "expression", "type": "expression", "loc": [268, 276], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "vector": [8, 1, 0.3875, 0.0128, 1, 0.74, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper that returns comments for a patch.\n\n Args:\n request: Django Request object.\n\n Returns:\n A 2-tuple of (old, new) where old/new are dictionaries that holds comments\n for that file, mapping from line number to a Comment entity."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L277_C2", "label": "old_dict =", "type": "assigned_variable", "loc": [277, 277], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "vector": [14, 1, 0.3946, 0.0014, 1, 0.74, 0.25, 360, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "old_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L278_C2", "label": "new_dict =", "type": "assigned_variable", "loc": [278, 278], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "vector": [14, 1, 0.396, 0.0014, 1, 0.74, 0.5, 631, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "new_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "label": "for comment", "type": "for", "loc": [282, 291], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "vector": [6, 1, 0.4081, 0.0142, 1, 0.74, 0.75, 34, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "comment", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for comment in models.Comment.gql('WHERE patch = :1 ORDER BY date',\n request.patch):\n if comment.draft and comment.author != request.user:\n continue # Only show your own drafts\n comment.complete()\n if comment.left:\n dct = old_dict\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L284_C4", "label": "if", "type": "if", "loc": [284, 285], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "vector": [4, 2, 0.4053, 0.0028, 2, 0.49, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment.draft and comment.author != request.user:\n continue # Only show your own drafts"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L286_C4", "label": "complete()", "type": "expression", "loc": [286, 286], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "vector": [8, 2, 0.4074, 0.0014, 2, 0.49, 0.3333, 482, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "complete", "arg_names": [], "import_names": [], "rhs_call_name": "complete", "annotation": ""}, "snippet": " comment.complete()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4", "label": "if", "type": "if", "loc": [287, 290], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "vector": [4, 2, 0.411, 0.0057, 2, 0.49, 0.6667, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if comment.left:\n dct = old_dict\n else:\n dct = new_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L288_C6", "label": "dct =", "type": "assigned_variable", "loc": [288, 288], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4", "vector": [14, 3, 0.4103, 0.0014, 3, 0.61, 0.0, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dct = old_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L290_C6", "label": "dct =", "type": "assigned_variable", "loc": [290, 290], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4", "vector": [14, 3, 0.4131, 0.0014, 3, 0.61, 1.0, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dct = new_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L291_C4", "label": "append()", "type": "expression", "loc": [291, 291], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "vector": [8, 2, 0.4145, 0.0014, 2, 0.49, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " dct.setdefault(comment.lineno, []).append(comment)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L292_C2", "label": "return", "type": "return", "loc": [292, 292], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "vector": [13, 1, 0.416, 0.0014, 1, 0.74, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return old_dict, new_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "label": "_RenderDiffTableRows", "type": "function", "loc": [295, 313], "level": 0, "parent": null, "vector": [2, 0, 0.433, 0.0271, 0, 0.66, 0.7143, 504, 0, 6, 1, 0, 0, 0, 4], "semantic": {"name": "_RenderDiffTableRows", "arg_names": ["request", "old_lines", "chunks", "patch", "colwidth", "debug"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _RenderDiffTableRows(request, old_lines, chunks, patch,\n colwidth=settings.DEFAULT_COLUMN_WIDTH, debug=False):\n \"\"\"Internal version of RenderDiffTableRows().\n\n Args:\n The same as for RenderDiffTableRows.\n\n Yields:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L297_C2", "label": "expression", "type": "expression", "loc": [297, 304], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [8, 1, 0.4281, 0.0114, 1, 0.59, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Internal version of RenderDiffTableRows().\n\n Args:\n The same as for RenderDiffTableRows.\n\n Yields:\n Tuples (tag, row) where tag is an indication of the row type.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L305_C2", "label": "old_dict =", "type": "assigned_variable", "loc": [305, 305], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [14, 1, 0.4345, 0.0014, 1, 0.59, 0.2, 360, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "old_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L306_C2", "label": "new_dict =", "type": "assigned_variable", "loc": [306, 306], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [14, 1, 0.4359, 0.0014, 1, 0.59, 0.4, 631, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "new_dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L307_C2", "label": "if", "type": "if", "loc": [307, 308], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [4, 1, 0.438, 0.0028, 1, 0.59, 0.6, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if patch:\n old_dict, new_dict = _GetComments(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L308_C4", "label": "old_dict, new_dict = _GetComments()", "type": "assigned_variable", "loc": [308, 308], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L307_C2", "vector": [14, 2, 0.4387, 0.0014, 2, 0.2, 0.0, 10, 3, 1, 0, 0, 815, 10, 1], "semantic": {"name": "old_dict, new_dict", "arg_names": [], "import_names": [], "rhs_call_name": "_GetComments", "annotation": ""}, "snippet": " old_dict, new_dict = _GetComments(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L309_C2", "label": "old_max, new_max = _ComputeLineCounts()", "type": "assigned_variable", "loc": [309, 309], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [14, 1, 0.4402, 0.0014, 1, 0.59, 0.8, 674, 3, 2, 0, 0, 555, 10, 1], "semantic": {"name": "old_max, new_max", "arg_names": [], "import_names": [], "rhs_call_name": "_ComputeLineCounts", "annotation": ""}, "snippet": " old_max, new_max = _ComputeLineCounts(old_lines, chunks)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L310_C2", "label": "return", "type": "return", "loc": [310, 313], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "vector": [13, 1, 0.4437, 0.0057, 1, 0.59, 1.0, 0, 3, 0, 0, 0, 0, 10, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return _TableRowGenerator(patch, old_dict, old_max, 'old',\n patch, new_dict, new_max, 'new',\n patching.PatchChunks(old_lines, chunks),\n colwidth, debug, request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "label": "_TableRowGenerator", "type": "function", "loc": [316, 464], "level": 0, "parent": null, "vector": [2, 0, 0.5556, 0.2123, 0, 0.66, 0.75, 949, 0, 12, 0, 0, 0, 0, 30], "semantic": {"name": "_TableRowGenerator", "arg_names": ["old_patch", "old_dict", "old_max", "old_snapshot", "new_patch", "new_dict", "new_max", "new_snapshot", "triple_iterator", "colwidth", "debug", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _TableRowGenerator(old_patch, old_dict, old_max, old_snapshot,\n new_patch, new_dict, new_max, new_snapshot,\n triple_iterator, colwidth=settings.DEFAULT_COLUMN_WIDTH,\n debug=False, request=None):\n \"\"\"Helper function to render side-by-side table rows.\n\n Args:\n old_patch: First models.Patch instance."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L320_C2", "label": "expression", "type": "expression", "loc": [320, 338], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [8, 1, 0.4687, 0.0271, 1, 0.55, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper function to render side-by-side table rows.\n\n Args:\n old_patch: First models.Patch instance.\n old_dict: Dictionary with line numbers as keys and comments as values (left)\n old_max: Line count of the patch on the left.\n old_snapshot: A tag used in the comments form.\n new_patch: Second models.Patch instance."}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L339_C2", "label": "diff_params = GetDiffParams()", "type": "assigned_variable", "loc": [339, 339], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [14, 1, 0.4829, 0.0014, 1, 0.55, 0.1429, 976, 3, 1, 0, 0, 303, 10, 1], "semantic": {"name": "diff_params", "arg_names": [], "import_names": [], "rhs_call_name": "GetDiffParams", "annotation": ""}, "snippet": " diff_params = intra_region_diff.GetDiffParams(dbg=debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L340_C2", "label": "ndigits =", "type": "assigned_variable", "loc": [340, 340], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [14, 1, 0.4843, 0.0014, 1, 0.55, 0.2857, 604, 4, 0, 0, 0, 0, 0, 5], "semantic": {"name": "ndigits", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ndigits = 1 + max(len(str(old_max)), len(str(new_max)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L341_C2", "label": "indent =", "type": "assigned_variable", "loc": [341, 341], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [14, 1, 0.4858, 0.0014, 1, 0.55, 0.4286, 231, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "indent", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " indent = 1 + ndigits"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L342_C2", "label": "old_offset =", "type": "assigned_variable", "loc": [342, 342], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [14, 1, 0.4872, 0.0014, 1, 0.55, 0.5714, 664, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "old_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_offset = new_offset = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L343_C2", "label": "row_count =", "type": "assigned_variable", "loc": [343, 343], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [14, 1, 0.4886, 0.0014, 1, 0.55, 0.7143, 266, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "row_count", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row_count = 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "label": "if", "type": "if", "loc": [346, 367], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [4, 1, 0.5078, 0.0313, 1, 0.55, 0.8571, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_patch == new_patch and (old_max == 0 or new_max == 0):\n if old_max == 0:\n msg_old = '(Empty)'\n else:\n msg_old = ''\n if new_max == 0:\n msg_new = '(Empty)'\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4", "label": "if", "type": "if", "loc": [347, 350], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "vector": [4, 2, 0.4964, 0.0057, 2, 0.29, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_max == 0:\n msg_old = '(Empty)'\n else:\n msg_old = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L348_C6", "label": "msg_old =", "type": "assigned_variable", "loc": [348, 348], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4", "vector": [14, 3, 0.4957, 0.0014, 3, 0.54, 0.0, 746, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_old", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_old = '(Empty)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L350_C6", "label": "msg_old =", "type": "assigned_variable", "loc": [350, 350], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4", "vector": [14, 3, 0.4986, 0.0014, 3, 0.54, 1.0, 746, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_old", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_old = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4", "label": "if", "type": "if", "loc": [351, 354], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "vector": [4, 2, 0.5021, 0.0057, 2, 0.29, 0.3333, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_max == 0:\n msg_new = '(Empty)'\n else:\n msg_new = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L352_C6", "label": "msg_new =", "type": "assigned_variable", "loc": [352, 352], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4", "vector": [14, 3, 0.5014, 0.0014, 3, 0.24, 0.0, 705, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_new", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_new = '(Empty)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L354_C6", "label": "msg_new =", "type": "assigned_variable", "loc": [354, 354], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4", "vector": [14, 3, 0.5043, 0.0014, 3, 0.24, 1.0, 705, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_new", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_new = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L355_C4", "label": "expression", "type": "expression", "loc": [355, 356], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "vector": [8, 2, 0.5064, 0.0028, 2, 0.29, 0.6667, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '', ('<tr><td class=\"info\">%s</td>'\n '<td class=\"info\">%s</td></tr>' % (msg_old, msg_new))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "label": "if", "type": "if", "loc": [357, 367], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "vector": [4, 2, 0.5157, 0.0157, 2, 0.29, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif old_patch is None or new_patch is None:\n msg_old = msg_new = ''\n if old_patch is None:\n msg_old = '(no file at all)'\n if new_patch is None:\n msg_new = '(no file at all)'\n yield '', ('<tr><td class=\"info\">%s</td>'\n '<td class=\"info\">%s</td></tr>' % (msg_old, msg_new))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L358_C4", "label": "msg_old =", "type": "assigned_variable", "loc": [358, 358], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "vector": [14, 3, 0.51, 0.0014, 3, 0.43, 0.0, 746, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_old", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_old = msg_new = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L359_C4", "label": "if", "type": "if", "loc": [359, 360], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "vector": [4, 3, 0.5121, 0.0028, 3, 0.43, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_patch is None:\n msg_old = '(no file at all)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L360_C6", "label": "msg_old =", "type": "assigned_variable", "loc": [360, 360], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L359_C4", "vector": [14, 4, 0.5128, 0.0014, 4, 0.79, 0.0, 746, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_old", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_old = '(no file at all)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L361_C4", "label": "if", "type": "if", "loc": [361, 362], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "vector": [4, 3, 0.515, 0.0028, 3, 0.43, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_patch is None:\n msg_new = '(no file at all)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L362_C6", "label": "msg_new =", "type": "assigned_variable", "loc": [362, 362], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L361_C4", "vector": [14, 4, 0.5157, 0.0014, 4, 0.59, 0.0, 705, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "msg_new", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " msg_new = '(no file at all)'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L363_C4", "label": "expression", "type": "expression", "loc": [363, 364], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "vector": [8, 3, 0.5178, 0.0028, 3, 0.43, 0.75, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '', ('<tr><td class=\"info\">%s</td>'\n '<td class=\"info\">%s</td></tr>' % (msg_old, msg_new))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L365_C2", "label": "if", "type": "if", "loc": [365, 367], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "vector": [4, 3, 0.5214, 0.0043, 3, 0.43, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif old_patch != new_patch and old_patch.lines == new_patch.lines:\n yield '', ('<tr><td class=\"info\" colspan=\"2\">'\n '(Both sides are equal)</td></tr>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L366_C4", "label": "expression", "type": "expression", "loc": [366, 367], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L365_C2", "vector": [8, 4, 0.5221, 0.0028, 4, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield '', ('<tr><td class=\"info\" colspan=\"2\">'\n '(Both sides are equal)</td></tr>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "label": "for tag, old, new", "type": "for", "loc": [369, 464], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "vector": [6, 1, 0.5933, 0.1368, 1, 0.55, 1.0, 671, 2, 0, 0, 0, 0, 0, 24], "semantic": {"name": "tag, old, new", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tag, old, new in triple_iterator:\n if tag.startswith('error'):\n yield 'error', '<tr><td><h3>%s</h3></td></tr>\\n' % cgi.escape(tag)\n return\n old1 = old_offset\n old_offset = old2 = old1 + len(old)\n new1 = new_offset\n new_offset = new2 = new1 + len(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4", "label": "if", "type": "if", "loc": [370, 372], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [4, 2, 0.5285, 0.0043, 2, 0.18, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag.startswith('error'):\n yield 'error', '<tr><td><h3>%s</h3></td></tr>\\n' % cgi.escape(tag)\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L371_C6", "label": "expression", "type": "expression", "loc": [371, 371], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4", "vector": [8, 3, 0.5285, 0.0014, 3, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield 'error', '<tr><td><h3>%s</h3></td></tr>\\n' % cgi.escape(tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L372_C6", "label": "return", "type": "return", "loc": [372, 372], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4", "vector": [13, 3, 0.5299, 0.0014, 3, 0.18, 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_1191:Assign_L373_C4", "label": "old1 =", "type": "assigned_variable", "loc": [373, 373], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5313, 0.0014, 2, 0.18, 0.1, 353, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old1 = old_offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L374_C4", "label": "old_offset =", "type": "assigned_variable", "loc": [374, 374], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5328, 0.0014, 2, 0.18, 0.2, 664, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "old_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_offset = old2 = old1 + len(old)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L375_C4", "label": "new1 =", "type": "assigned_variable", "loc": [375, 375], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5342, 0.0014, 2, 0.18, 0.3, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new1", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new1 = new_offset"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L376_C4", "label": "new_offset =", "type": "assigned_variable", "loc": [376, 376], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5356, 0.0014, 2, 0.18, 0.4, 453, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "new_offset", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_offset = new2 = new1 + len(new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L377_C4", "label": "old_buff =", "type": "assigned_variable", "loc": [377, 377], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.537, 0.0014, 2, 0.18, 0.5, 321, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "old_buff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_buff = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L378_C4", "label": "new_buff =", "type": "assigned_variable", "loc": [378, 378], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5385, 0.0014, 2, 0.18, 0.6, 193, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_buff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_buff = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L379_C4", "label": "frag_list =", "type": "assigned_variable", "loc": [379, 379], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5399, 0.0014, 2, 0.18, 0.7, 256, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "frag_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frag_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L380_C4", "label": "do_ir_diff =", "type": "assigned_variable", "loc": [380, 380], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [14, 2, 0.5413, 0.0014, 2, 0.18, 0.8, 446, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "do_ir_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " do_ir_diff = tag == 'replace' and intra_region_diff.CanDoIRDiff(old, new)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "label": "for i", "type": "for", "loc": [382, 429], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [6, 2, 0.5776, 0.0684, 2, 0.18, 0.9, 826, 3, 0, 0, 0, 0, 0, 13], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(max(len(old), len(new))):\n row_count += 1\n old_lineno = old1 + i + 1\n new_lineno = new1 + i + 1\n old_valid = old1+i < old2\n new_valid = new1+i < new2\n\n # Start rendering the first row"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L384_C6", "label": "old_lineno =", "type": "assigned_variable", "loc": [384, 384], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.547, 0.0014, 3, 0.43, 0.0, 671, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_lineno = old1 + i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L385_C6", "label": "new_lineno =", "type": "assigned_variable", "loc": [385, 385], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.5484, 0.0014, 3, 0.43, 0.0833, 589, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_lineno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_lineno = new1 + i + 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L386_C6", "label": "old_valid =", "type": "assigned_variable", "loc": [386, 386], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.5499, 0.0014, 3, 0.43, 0.1667, 391, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_valid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_valid = old1+i < old2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L387_C6", "label": "new_valid =", "type": "assigned_variable", "loc": [387, 387], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.5513, 0.0014, 3, 0.43, 0.25, 278, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_valid", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_valid = new1+i < new2"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L390_C6", "label": "frags =", "type": "assigned_variable", "loc": [390, 390], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.5556, 0.0014, 3, 0.43, 0.3333, 699, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "frags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frags = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6", "label": "if", "type": "if", "loc": [391, 395], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [4, 3, 0.5598, 0.0071, 3, 0.43, 0.4167, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == 0 and tag != 'equal':\n # Mark the first row of each non-equal chunk as a 'hook'.\n frags.append('<tr name=\"hook\"')\n else:\n frags.append('<tr')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L393_C8", "label": "append()", "type": "expression", "loc": [393, 393], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6", "vector": [8, 4, 0.5598, 0.0014, 4, 0.16, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr name=\"hook\"')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L395_C8", "label": "append()", "type": "expression", "loc": [395, 395], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6", "vector": [8, 4, 0.5627, 0.0014, 4, 0.16, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L396_C6", "label": "append()", "type": "expression", "loc": [396, 396], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [8, 3, 0.5641, 0.0014, 3, 0.43, 0.5, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(' id=\"pair-%d\">' % row_count)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L398_C6", "label": "old_intra_diff =", "type": "assigned_variable", "loc": [398, 398], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.567, 0.0014, 3, 0.43, 0.5833, 204, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "old_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_intra_diff = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L399_C6", "label": "new_intra_diff =", "type": "assigned_variable", "loc": [399, 399], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [14, 3, 0.5684, 0.0014, 3, 0.43, 0.6667, 261, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "new_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_intra_diff = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L400_C6", "label": "if", "type": "if", "loc": [400, 401], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [4, 3, 0.5705, 0.0028, 3, 0.43, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_valid:\n old_intra_diff = old[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L401_C8", "label": "old_intra_diff =", "type": "assigned_variable", "loc": [401, 401], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L400_C6", "vector": [14, 4, 0.5712, 0.0014, 4, 0.65, 0.0, 204, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_intra_diff = old[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L402_C6", "label": "if", "type": "if", "loc": [402, 403], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [4, 3, 0.5734, 0.0028, 3, 0.43, 0.8333, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_valid:\n new_intra_diff = new[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L403_C8", "label": "new_intra_diff =", "type": "assigned_variable", "loc": [403, 403], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L402_C6", "vector": [14, 4, 0.5741, 0.0014, 4, 0.42, 0.0, 261, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_intra_diff = new[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L405_C6", "label": "append()", "type": "expression", "loc": [405, 405], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [8, 3, 0.5769, 0.0014, 3, 0.43, 0.9167, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frag_list.append(frags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "label": "if", "type": "if", "loc": [406, 429], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "vector": [4, 3, 0.5947, 0.0342, 3, 0.43, 1.0, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if do_ir_diff:\n # Don't render yet. Keep saving state necessary to render the whole\n # region until we have encountered all the lines in the region.\n old_buff.append([old_valid, old_lineno, old_intra_diff])\n new_buff.append([new_valid, new_lineno, new_intra_diff])\n else:\n # We render line by line as usual if do_ir_diff is false\n old_intra_diff = intra_region_diff.Break("}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L409_C8", "label": "append()", "type": "expression", "loc": [409, 409], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [8, 4, 0.5826, 0.0014, 4, 0.16, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " old_buff.append([old_valid, old_lineno, old_intra_diff])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L410_C8", "label": "append()", "type": "expression", "loc": [410, 410], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [8, 4, 0.584, 0.0014, 4, 0.16, 0.1429, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " new_buff.append([new_valid, new_lineno, new_intra_diff])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L413_C8", "label": "old_intra_diff = Break()", "type": "assigned_variable", "loc": [413, 414], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [14, 4, 0.589, 0.0028, 4, 0.16, 0.2857, 204, 3, 4, 0, 0, 654, 10, 1], "semantic": {"name": "old_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "Break", "annotation": ""}, "snippet": " old_intra_diff = intra_region_diff.Break(\n old_intra_diff, 0, colwidth, \"\\n\" + \" \"*indent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L415_C8", "label": "new_intra_diff = Break()", "type": "assigned_variable", "loc": [415, 416], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [14, 4, 0.5919, 0.0028, 4, 0.16, 0.4286, 261, 3, 4, 0, 0, 654, 10, 1], "semantic": {"name": "new_intra_diff", "arg_names": [], "import_names": [], "rhs_call_name": "Break", "annotation": ""}, "snippet": " new_intra_diff = intra_region_diff.Break(\n new_intra_diff, 0, colwidth, \"\\n\" + \" \"*indent)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L417_C8", "label": "old_buff_out =", "type": "assigned_variable", "loc": [417, 418], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [14, 4, 0.5947, 0.0028, 4, 0.16, 0.5714, 863, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "old_buff_out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_buff_out = [[old_valid, old_lineno,\n (old_intra_diff, True, None)]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L419_C8", "label": "new_buff_out =", "type": "assigned_variable", "loc": [419, 420], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [14, 4, 0.5976, 0.0028, 4, 0.16, 0.7143, 266, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_buff_out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_buff_out = [[new_valid, new_lineno,\n (new_intra_diff, True, None)]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L421_C8", "label": "for tg, frag", "type": "for", "loc": [421, 428], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [6, 4, 0.6047, 0.0114, 4, 0.16, 0.8571, 843, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tg, frag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tg, frag in _RenderDiffInternal(old_buff_out, new_buff_out,\n ndigits, tag, frag_list,\n do_ir_diff,\n old_dict, new_dict,\n old_patch, new_patch,\n old_snapshot, new_snapshot,\n debug, request):\n yield tg, frag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L428_C10", "label": "expression", "type": "expression", "loc": [428, 428], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L421_C8", "vector": [8, 5, 0.6097, 0.0014, 5, 0.18, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield tg, frag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L429_C8", "label": "frag_list =", "type": "assigned_variable", "loc": [429, 429], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "vector": [14, 4, 0.6111, 0.0014, 4, 0.16, 1.0, 256, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "frag_list", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frag_list = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "label": "if", "type": "if", "loc": [431, 464], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "vector": [4, 2, 0.6375, 0.0484, 2, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if do_ir_diff:\n # So this was a replace block which means that the whole region still\n # needs to be rendered.\n old_lines = [b[2] for b in old_buff]\n new_lines = [b[2] for b in new_buff]\n ret = intra_region_diff.IntraRegionDiff(old_lines, new_lines,\n diff_params)\n old_chunks, new_chunks, ratio = ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L434_C6", "label": "old_lines =", "type": "assigned_variable", "loc": [434, 434], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6182, 0.0014, 3, 0.97, 0.0, 920, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_lines = [b[2] for b in old_buff]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L435_C6", "label": "new_lines =", "type": "assigned_variable", "loc": [435, 435], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6197, 0.0014, 3, 0.97, 0.0833, 675, 5, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_lines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_lines = [b[2] for b in new_buff]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L436_C6", "label": "ret = IntraRegionDiff()", "type": "assigned_variable", "loc": [436, 437], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6218, 0.0028, 3, 0.97, 0.1667, 501, 3, 3, 0, 0, 257, 10, 1], "semantic": {"name": "ret", "arg_names": [], "import_names": [], "rhs_call_name": "IntraRegionDiff", "annotation": ""}, "snippet": " ret = intra_region_diff.IntraRegionDiff(old_lines, new_lines,\n diff_params)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L438_C6", "label": "old_chunks, new_chunks, ratio =", "type": "assigned_variable", "loc": [438, 438], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6239, 0.0014, 3, 0.97, 0.25, 589, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_chunks, new_chunks, ratio", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_chunks, new_chunks, ratio = ret"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L439_C6", "label": "old_tag =", "type": "assigned_variable", "loc": [439, 439], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6254, 0.0014, 3, 0.97, 0.3333, 278, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "old_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_tag = 'old'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L440_C6", "label": "new_tag =", "type": "assigned_variable", "loc": [440, 440], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6268, 0.0014, 3, 0.97, 0.4167, 830, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "new_tag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_tag = 'new'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L442_C6", "label": "old_diff_out = RenderIntraRegionDiff()", "type": "assigned_variable", "loc": [442, 445], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6318, 0.0057, 3, 0.97, 0.5, 99, 3, 8, 0, 0, 246, 10, 1], "semantic": {"name": "old_diff_out", "arg_names": [], "import_names": [], "rhs_call_name": "RenderIntraRegionDiff", "annotation": ""}, "snippet": " old_diff_out = intra_region_diff.RenderIntraRegionDiff(\n old_lines, old_chunks, old_tag, ratio,\n limit=colwidth, indent=indent, mark_tabs=True,\n dbg=debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L446_C6", "label": "new_diff_out = RenderIntraRegionDiff()", "type": "assigned_variable", "loc": [446, 449], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6375, 0.0057, 3, 0.97, 0.5833, 211, 3, 8, 0, 0, 246, 10, 1], "semantic": {"name": "new_diff_out", "arg_names": [], "import_names": [], "rhs_call_name": "RenderIntraRegionDiff", "annotation": ""}, "snippet": " new_diff_out = intra_region_diff.RenderIntraRegionDiff(\n new_lines, new_chunks, new_tag, ratio,\n limit=colwidth, indent=indent, mark_tabs=True,\n dbg=debug)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L450_C6", "label": "for i, b", "type": "for", "loc": [450, 451], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [6, 3, 0.6417, 0.0028, 3, 0.97, 0.6667, 758, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i, b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (i, b) in enumerate(old_buff):\n b[2] = old_diff_out[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L451_C8", "label": "assign", "type": "assigned_variable", "loc": [451, 451], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L450_C6", "vector": [14, 4, 0.6425, 0.0014, 4, 0.23, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b[2] = old_diff_out[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L452_C6", "label": "for i, b", "type": "for", "loc": [452, 453], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [6, 3, 0.6446, 0.0028, 3, 0.97, 0.75, 758, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i, b", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for (i, b) in enumerate(new_buff):\n b[2] = new_diff_out[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L453_C8", "label": "assign", "type": "assigned_variable", "loc": [453, 453], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L452_C6", "vector": [14, 4, 0.6453, 0.0014, 4, 0.54, 0.0, 0, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " b[2] = new_diff_out[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L455_C6", "label": "for tg, frag", "type": "for", "loc": [455, 462], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [6, 3, 0.6531, 0.0114, 3, 0.97, 0.8333, 843, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "tg, frag", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for tg, frag in _RenderDiffInternal(old_buff, new_buff,\n ndigits, tag, frag_list,\n do_ir_diff,\n old_dict, new_dict,\n old_patch, new_patch,\n old_snapshot, new_snapshot,\n debug, request):\n yield tg, frag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L462_C8", "label": "expression", "type": "expression", "loc": [462, 462], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L455_C6", "vector": [8, 4, 0.6581, 0.0014, 4, 0.95, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield tg, frag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L463_C6", "label": "old_buff =", "type": "assigned_variable", "loc": [463, 463], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.6595, 0.0014, 3, 0.97, 0.9167, 321, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "old_buff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_buff = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L464_C6", "label": "new_buff =", "type": "assigned_variable", "loc": [464, 464], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "vector": [14, 3, 0.661, 0.0014, 3, 0.97, 1.0, 193, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "new_buff", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_buff = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "label": "_RenderDiffInternal", "type": "function", "loc": [467, 539], "level": 0, "parent": null, "vector": [2, 0, 0.7165, 0.104, 0, 0.66, 0.7857, 246, 0, 14, 0, 0, 0, 0, 24], "semantic": {"name": "_RenderDiffInternal", "arg_names": ["old_buff", "new_buff", "ndigits", "tag", "frag_list", "do_ir_diff", "old_dict", "new_dict", "old_patch", "new_patch", "old_snapshot", "new_snapshot", "debug", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _RenderDiffInternal(old_buff, new_buff, ndigits, tag, frag_list,\n do_ir_diff, old_dict, new_dict,\n old_patch, new_patch,\n old_snapshot, new_snapshot,\n debug, request):\n \"\"\"Helper for _TableRowGenerator().\"\"\"\n obegin = (intra_region_diff.BEGIN_TAG %\n intra_region_diff.COLOR_SCHEME['old']['match'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L472_C2", "label": "expression", "type": "expression", "loc": [472, 472], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [8, 1, 0.6724, 0.0014, 1, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper for _TableRowGenerator().\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L473_C2", "label": "obegin =", "type": "assigned_variable", "loc": [473, 474], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [14, 1, 0.6745, 0.0028, 1, 0.99, 0.1667, 80, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "obegin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " obegin = (intra_region_diff.BEGIN_TAG %\n intra_region_diff.COLOR_SCHEME['old']['match'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L475_C2", "label": "nbegin =", "type": "assigned_variable", "loc": [475, 476], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [14, 1, 0.6774, 0.0028, 1, 0.99, 0.3333, 713, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nbegin", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nbegin = (intra_region_diff.BEGIN_TAG %\n intra_region_diff.COLOR_SCHEME['new']['match'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L477_C2", "label": "oend =", "type": "assigned_variable", "loc": [477, 477], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [14, 1, 0.6795, 0.0014, 1, 0.99, 0.5, 820, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "oend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " oend = intra_region_diff.END_TAG"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L478_C2", "label": "nend =", "type": "assigned_variable", "loc": [478, 478], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [14, 1, 0.6809, 0.0014, 1, 0.99, 0.6667, 728, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "nend", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " nend = oend"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L479_C2", "label": "user = get_current_user()", "type": "assigned_variable", "loc": [479, 479], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [14, 1, 0.6823, 0.0014, 1, 0.99, 0.8333, 503, 3, 0, 0, 0, 722, 10, 1], "semantic": {"name": "user", "arg_names": [], "import_names": [], "rhs_call_name": "get_current_user", "annotation": ""}, "snippet": " user = users.get_current_user()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "label": "for i", "type": "for", "loc": [481, 539], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "vector": [6, 1, 0.7265, 0.084, 1, 0.99, 1.0, 826, 3, 0, 0, 0, 0, 0, 23], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in xrange(len(old_buff)):\n tg = tag\n old_valid, old_lineno, old_out = old_buff[i]\n new_valid, new_lineno, new_out = new_buff[i]\n old_intra_diff, old_has_newline, old_debug_info = old_out\n new_intra_diff, new_has_newline, new_debug_info = new_out\n\n frags = frag_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L482_C4", "label": "tg =", "type": "assigned_variable", "loc": [482, 482], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.6866, 0.0014, 2, 0.22, 0.0, 870, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "tg", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " tg = tag"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L483_C4", "label": "old_valid, old_lineno, old_out =", "type": "assigned_variable", "loc": [483, 483], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.688, 0.0014, 2, 0.22, 0.0909, 942, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_valid, old_lineno, old_out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_valid, old_lineno, old_out = old_buff[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L484_C4", "label": "new_valid, new_lineno, new_out =", "type": "assigned_variable", "loc": [484, 484], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.6895, 0.0014, 2, 0.22, 0.1818, 304, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_valid, new_lineno, new_out", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_valid, new_lineno, new_out = new_buff[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L485_C4", "label": "old_intra_diff, old_has_newline, old_debug_info =", "type": "assigned_variable", "loc": [485, 485], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.6909, 0.0014, 2, 0.22, 0.2727, 858, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_intra_diff, old_has_newline, old_debug_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " old_intra_diff, old_has_newline, old_debug_info = old_out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L486_C4", "label": "new_intra_diff, new_has_newline, new_debug_info =", "type": "assigned_variable", "loc": [486, 486], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.6923, 0.0014, 2, 0.22, 0.3636, 837, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_intra_diff, new_has_newline, new_debug_info", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_intra_diff, new_has_newline, new_debug_info = new_out"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L488_C4", "label": "frags =", "type": "assigned_variable", "loc": [488, 488], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [14, 2, 0.6952, 0.0014, 2, 0.22, 0.4545, 699, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "frags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frags = frag_list[i]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L490_C4", "label": "append()", "type": "expression", "loc": [490, 492], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [8, 2, 0.6994, 0.0043, 2, 0.22, 0.5455, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(_RenderDiffColumn(old_valid, tag, ndigits,\n old_lineno, obegin, oend, old_intra_diff,\n do_ir_diff, old_has_newline, 'old'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L495_C4", "label": "append()", "type": "expression", "loc": [495, 497], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [8, 2, 0.7066, 0.0043, 2, 0.22, 0.6364, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(_RenderDiffColumn(new_valid, tag, ndigits,\n new_lineno, nbegin, nend, new_intra_diff,\n do_ir_diff, new_has_newline, 'new'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L500_C4", "label": "append()", "type": "expression", "loc": [500, 500], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [8, 2, 0.7123, 0.0014, 2, 0.22, 0.7273, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('</tr>\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "label": "if", "type": "if", "loc": [502, 514], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [4, 2, 0.7236, 0.0185, 2, 0.22, 0.8182, 0, 2, 0, 0, 0, 0, 0, 8], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if debug:\n frags.append('<tr>')\n if old_debug_info:\n frags.append('<td class=\"debug-info\">%s</td>' %\n old_debug_info.replace('\\n', '<br>'))\n else:\n frags.append('<td></td>')\n if new_debug_info:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L503_C6", "label": "append()", "type": "expression", "loc": [503, 503], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "vector": [8, 3, 0.7165, 0.0014, 3, 0.48, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6", "label": "if", "type": "if", "loc": [504, 508], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "vector": [4, 3, 0.7208, 0.0071, 3, 0.48, 0.3333, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_debug_info:\n frags.append('<td class=\"debug-info\">%s</td>' %\n old_debug_info.replace('\\n', '<br>'))\n else:\n frags.append('<td></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L505_C8", "label": "append()", "type": "expression", "loc": [505, 506], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6", "vector": [8, 4, 0.7201, 0.0028, 4, 0.6, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<td class=\"debug-info\">%s</td>' %\n old_debug_info.replace('\\n', '<br>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L508_C8", "label": "append()", "type": "expression", "loc": [508, 508], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6", "vector": [8, 4, 0.7236, 0.0014, 4, 0.6, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<td></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6", "label": "if", "type": "if", "loc": [509, 513], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "vector": [4, 3, 0.7279, 0.0071, 3, 0.48, 0.6667, 0, 2, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if new_debug_info:\n frags.append('<td class=\"debug-info\">%s</td>' %\n new_debug_info.replace('\\n', '<br>'))\n else:\n frags.append('<td></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L510_C8", "label": "append()", "type": "expression", "loc": [510, 511], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6", "vector": [8, 4, 0.7272, 0.0028, 4, 0.33, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<td class=\"debug-info\">%s</td>' %\n new_debug_info.replace('\\n', '<br>'))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L513_C8", "label": "append()", "type": "expression", "loc": [513, 513], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6", "vector": [8, 4, 0.7308, 0.0014, 4, 0.33, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<td></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L514_C6", "label": "append()", "type": "expression", "loc": [514, 514], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "vector": [8, 3, 0.7322, 0.0014, 3, 0.48, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('</tr>\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "label": "if", "type": "if", "loc": [516, 536], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [4, 2, 0.7493, 0.0299, 2, 0.22, 0.9091, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_patch or new_patch:\n # Start rendering the second row\n if ((old_valid and old_lineno in old_dict) or\n (new_valid and new_lineno in new_dict)):\n tg += '_comment'\n frags.append('<tr class=\"inline-comments\" name=\"hook\">')\n else:\n frags.append('<tr class=\"inline-comments\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6", "label": "if", "type": "if", "loc": [518, 523], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "vector": [4, 3, 0.7415, 0.0085, 3, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ((old_valid and old_lineno in old_dict) or\n (new_valid and new_lineno in new_dict)):\n tg += '_comment'\n frags.append('<tr class=\"inline-comments\" name=\"hook\">')\n else:\n frags.append('<tr class=\"inline-comments\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L521_C8", "label": "append()", "type": "expression", "loc": [521, 521], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6", "vector": [8, 4, 0.7422, 0.0014, 4, 0.03, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr class=\"inline-comments\" name=\"hook\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L523_C8", "label": "append()", "type": "expression", "loc": [523, 523], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6", "vector": [8, 4, 0.745, 0.0014, 4, 0.03, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr class=\"inline-comments\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L526_C6", "label": "append()", "type": "expression", "loc": [526, 528], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "vector": [8, 3, 0.7507, 0.0043, 3, 0.51, 0.3333, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(_RenderInlineComments(old_valid, old_lineno, old_dict,\n user, old_patch, old_snapshot, 'old',\n request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L531_C6", "label": "append()", "type": "expression", "loc": [531, 533], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "vector": [8, 3, 0.7578, 0.0043, 3, 0.51, 0.6667, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(_RenderInlineComments(new_valid, new_lineno, new_dict,\n user, new_patch, new_snapshot, 'new',\n request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L536_C6", "label": "append()", "type": "expression", "loc": [536, 536], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "vector": [8, 3, 0.7635, 0.0014, 3, 0.51, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('</tr>\\n')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L539_C4", "label": "expression", "type": "expression", "loc": [539, 539], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "vector": [8, 2, 0.7678, 0.0014, 2, 0.22, 1.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " yield tg, ''.join(frags)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L542_C0", "label": "_RenderDiffColumn", "type": "function", "loc": [542, 566], "level": 0, "parent": null, "vector": [2, 0, 0.7892, 0.0356, 0, 0.66, 0.8214, 634, 0, 10, 1, 0, 0, 0, 1], "semantic": {"name": "_RenderDiffColumn", "arg_names": ["line_valid", "tag", "ndigits", "lineno", "begin", "end", "intra_diff", "do_ir_diff", "has_newline", "prefix"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _RenderDiffColumn(line_valid, tag, ndigits, lineno, begin, end,\n intra_diff, do_ir_diff, has_newline, prefix):\n \"\"\"Helper function for _RenderDiffInternal().\n\n Returns:\n A rendered column.\n \"\"\"\n if line_valid:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L544_C2", "label": "expression", "type": "expression", "loc": [544, 548], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L542_C0", "vector": [8, 1, 0.7778, 0.0071, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper function for _RenderDiffInternal().\n\n Returns:\n A rendered column.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "label": "if", "type": "if", "loc": [549, 566], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L542_C0", "vector": [4, 1, 0.7942, 0.0256, 1, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line_valid:\n cls_attr = '%s%s' % (prefix, tag)\n if tag == 'equal':\n lno = '%*d' % (ndigits, lineno)\n else:\n lno = _MarkupNumber(ndigits, lineno, 'u')\n if tag == 'replace':\n col_content = ('%s%s %s%s' % (begin, lno, end, intra_diff))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L550_C4", "label": "cls_attr =", "type": "assigned_variable", "loc": [550, 550], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "vector": [14, 2, 0.7835, 0.0014, 2, 0.04, 0.0, 379, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls_attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls_attr = '%s%s' % (prefix, tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4", "label": "if", "type": "if", "loc": [551, 554], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "vector": [4, 2, 0.787, 0.0057, 2, 0.04, 0.25, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'equal':\n lno = '%*d' % (ndigits, lineno)\n else:\n lno = _MarkupNumber(ndigits, lineno, 'u')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L552_C6", "label": "lno =", "type": "assigned_variable", "loc": [552, 552], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4", "vector": [14, 3, 0.7863, 0.0014, 3, 0.37, 0.0, 593, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "lno", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " lno = '%*d' % (ndigits, lineno)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L554_C6", "label": "lno = _MarkupNumber()", "type": "assigned_variable", "loc": [554, 554], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4", "vector": [14, 3, 0.7892, 0.0014, 3, 0.37, 1.0, 593, 3, 3, 0, 0, 524, 10, 1], "semantic": {"name": "lno", "arg_names": [], "import_names": [], "rhs_call_name": "_MarkupNumber", "annotation": ""}, "snippet": " lno = _MarkupNumber(ndigits, lineno, 'u')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "label": "if", "type": "if", "loc": [555, 562], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "vector": [4, 2, 0.7956, 0.0114, 2, 0.04, 0.5, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if tag == 'replace':\n col_content = ('%s%s %s%s' % (begin, lno, end, intra_diff))\n # If IR diff has been turned off or there is no matching new line at\n # the end then switch to dark background CSS style.\n if not do_ir_diff or not has_newline:\n cls_attr = cls_attr + '1'\n else:\n col_content = '%s %s' % (lno, intra_diff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L556_C6", "label": "col_content =", "type": "assigned_variable", "loc": [556, 556], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "vector": [14, 3, 0.792, 0.0014, 3, 0.42, 0.0, 322, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "col_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " col_content = ('%s%s %s%s' % (begin, lno, end, intra_diff))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L559_C6", "label": "if", "type": "if", "loc": [559, 560], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "vector": [4, 3, 0.797, 0.0028, 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 not do_ir_diff or not has_newline:\n cls_attr = cls_attr + '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L560_C8", "label": "cls_attr =", "type": "assigned_variable", "loc": [560, 560], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L559_C6", "vector": [14, 4, 0.7977, 0.0014, 4, 0.94, 0.0, 379, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "cls_attr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " cls_attr = cls_attr + '1'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L562_C6", "label": "col_content =", "type": "assigned_variable", "loc": [562, 562], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "vector": [14, 3, 0.8006, 0.0014, 3, 0.42, 1.0, 322, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "col_content", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " col_content = '%s %s' % (lno, intra_diff)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L563_C4", "label": "return", "type": "return", "loc": [563, 564], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "vector": [13, 2, 0.8027, 0.0028, 2, 0.04, 0.75, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<td class=\"%s\" id=\"%scode%d\">%s</td>' % (cls_attr, prefix,\n lineno, col_content)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L566_C4", "label": "return", "type": "return", "loc": [566, 566], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "vector": [13, 2, 0.8063, 0.0014, 2, 0.04, 1.0, 0, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return '<td class=\"%sblank\"></td>' % prefix"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "label": "_RenderInlineComments", "type": "function", "loc": [569, 595], "level": 0, "parent": null, "vector": [2, 0, 0.8291, 0.0385, 0, 0.66, 0.8571, 813, 0, 8, 1, 0, 0, 0, 6], "semantic": {"name": "_RenderInlineComments", "arg_names": ["line_valid", "lineno", "data", "user", "patch", "snapshot", "prefix", "request"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _RenderInlineComments(line_valid, lineno, data, user,\n patch, snapshot, prefix, request):\n \"\"\"Helper function for _RenderDiffInternal().\n\n Returns:\n Rendered comments.\n \"\"\"\n comments = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L571_C2", "label": "expression", "type": "expression", "loc": [571, 575], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "vector": [8, 1, 0.8162, 0.0071, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Helper function for _RenderDiffInternal().\n\n Returns:\n Rendered comments.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L576_C2", "label": "comments =", "type": "assigned_variable", "loc": [576, 576], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "vector": [14, 1, 0.8205, 0.0014, 1, 0.37, 0.3333, 122, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "comments", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " comments = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "label": "if", "type": "if", "loc": [577, 594], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "vector": [4, 1, 0.834, 0.0256, 1, 0.37, 0.6667, 0, 2, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line_valid:\n comments.append('<td id=\"%s-line-%s\">' % (prefix, lineno))\n if lineno in data:\n comments.append(\n _ExpandTemplate('inline_comment.html',\n request,\n user=user,\n patch=patch,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L578_C4", "label": "append()", "type": "expression", "loc": [578, 578], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "vector": [8, 2, 0.8234, 0.0014, 2, 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": " comments.append('<td id=\"%s-line-%s\">' % (prefix, lineno))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L579_C4", "label": "if", "type": "if", "loc": [579, 591], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "vector": [4, 2, 0.8333, 0.0185, 2, 0.59, 0.3333, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lineno in data:\n comments.append(\n _ExpandTemplate('inline_comment.html',\n request,\n user=user,\n patch=patch,\n patchset=patch.patchset,\n issue=patch.patchset.issue,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L580_C6", "label": "append()", "type": "expression", "loc": [580, 591], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L579_C4", "vector": [8, 3, 0.834, 0.0171, 3, 0.69, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " comments.append(\n _ExpandTemplate('inline_comment.html',\n request,\n user=user,\n patch=patch,\n patchset=patch.patchset,\n issue=patch.patchset.issue,\n snapshot=snapshot,"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L592_C4", "label": "append()", "type": "expression", "loc": [592, 592], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "vector": [8, 2, 0.8433, 0.0014, 2, 0.59, 0.6667, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " comments.append('</td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L594_C4", "label": "append()", "type": "expression", "loc": [594, 594], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "vector": [8, 2, 0.8462, 0.0014, 2, 0.59, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " comments.append('<td></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L595_C2", "label": "return", "type": "return", "loc": [595, 595], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "vector": [13, 1, 0.8476, 0.0014, 1, 0.37, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ''.join(comments)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "label": "RenderUnifiedTableRows", "type": "function", "loc": [598, 651], "level": 0, "parent": null, "vector": [2, 0, 0.8896, 0.0769, 0, 0.66, 0.8929, 27, 0, 2, 1, 0, 0, 0, 11], "semantic": {"name": "RenderUnifiedTableRows", "arg_names": ["request", "parsed_lines"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def RenderUnifiedTableRows(request, parsed_lines):\n \"\"\"Render the HTML table rows for a unified diff for a patch.\n\n Args:\n request: Django Request object.\n parsed_lines: List of tuples for each line that contain the line number,\n if they exist, for the old and new file.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L599_C2", "label": "expression", "type": "expression", "loc": [599, 608], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "vector": [8, 1, 0.8597, 0.0142, 1, 0.24, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Render the HTML table rows for a unified diff for a patch.\n\n Args:\n request: Django Request object.\n parsed_lines: List of tuples for each line that contain the line number,\n if they exist, for the old and new file.\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L609_C2", "label": "old_dict, new_dict = _GetComments()", "type": "assigned_variable", "loc": [609, 609], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "vector": [14, 1, 0.8675, 0.0014, 1, 0.24, 0.25, 10, 3, 1, 0, 0, 815, 10, 1], "semantic": {"name": "old_dict, new_dict", "arg_names": [], "import_names": [], "rhs_call_name": "_GetComments", "annotation": ""}, "snippet": " old_dict, new_dict = _GetComments(request)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L611_C2", "label": "rows =", "type": "assigned_variable", "loc": [611, 611], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "vector": [14, 1, 0.8704, 0.0014, 1, 0.24, 0.5, 275, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "rows", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " rows = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "label": "for old_line_no, new_line_no, line_text", "type": "for", "loc": [612, 650], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "vector": [6, 1, 0.8989, 0.0556, 1, 0.24, 0.75, 45, 2, 0, 0, 0, 0, 0, 10], "semantic": {"name": "old_line_no, new_line_no, line_text", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for old_line_no, new_line_no, line_text in parsed_lines:\n row1_id = row2_id = ''\n # When a line is unchanged (i.e. both old_line_no and new_line_no aren't 0)\n # pick the old column line numbers when adding a comment.\n if old_line_no:\n row1_id = 'id=\"oldcode%d\"' % old_line_no\n row2_id = 'id=\"old-line-%d\"' % old_line_no\n elif new_line_no:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L613_C4", "label": "row1_id =", "type": "assigned_variable", "loc": [613, 613], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [14, 2, 0.8732, 0.0014, 2, 0.8, 0.0, 470, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "row1_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row1_id = row2_id = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "label": "if", "type": "if", "loc": [616, 621], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [4, 2, 0.8811, 0.0085, 2, 0.8, 0.1429, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_line_no:\n row1_id = 'id=\"oldcode%d\"' % old_line_no\n row2_id = 'id=\"old-line-%d\"' % old_line_no\n elif new_line_no:\n row1_id = 'id=\"newcode%d\"' % new_line_no\n row2_id = 'id=\"new-line-%d\"' % new_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L617_C6", "label": "row1_id =", "type": "assigned_variable", "loc": [617, 617], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "vector": [14, 3, 0.8789, 0.0014, 3, 0.9, 0.0, 470, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row1_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row1_id = 'id=\"oldcode%d\"' % old_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L618_C6", "label": "row2_id =", "type": "assigned_variable", "loc": [618, 618], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "vector": [14, 3, 0.8803, 0.0014, 3, 0.9, 0.5, 884, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row2_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row2_id = 'id=\"old-line-%d\"' % old_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4", "label": "if", "type": "if", "loc": [619, 621], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "vector": [4, 3, 0.8832, 0.0043, 3, 0.9, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif new_line_no:\n row1_id = 'id=\"newcode%d\"' % new_line_no\n row2_id = 'id=\"new-line-%d\"' % new_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L620_C6", "label": "row1_id =", "type": "assigned_variable", "loc": [620, 620], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4", "vector": [14, 4, 0.8832, 0.0014, 4, 0.24, 0.0, 470, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row1_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row1_id = 'id=\"newcode%d\"' % new_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L621_C6", "label": "row2_id =", "type": "assigned_variable", "loc": [621, 621], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4", "vector": [14, 4, 0.8846, 0.0014, 4, 0.24, 1.0, 884, 4, 0, 0, 0, 0, 0, 0], "semantic": {"name": "row2_id", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " row2_id = 'id=\"new-line-%d\"' % new_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4", "label": "if", "type": "if", "loc": [623, 628], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [4, 2, 0.891, 0.0085, 2, 0.8, 0.2857, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if line_text[0] == '+':\n style = 'udiffadd'\n elif line_text[0] == '-':\n style = 'udiffremove'\n else:\n style = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L624_C6", "label": "style =", "type": "assigned_variable", "loc": [624, 624], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4", "vector": [14, 3, 0.8889, 0.0014, 3, 0.25, 0.0, 3, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " style = 'udiffadd'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4", "label": "if", "type": "if", "loc": [625, 628], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4", "vector": [4, 3, 0.8925, 0.0057, 3, 0.25, 1.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif line_text[0] == '-':\n style = 'udiffremove'\n else:\n style = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L626_C6", "label": "style =", "type": "assigned_variable", "loc": [626, 626], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4", "vector": [14, 4, 0.8917, 0.0014, 4, 0.18, 0.0, 3, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " style = 'udiffremove'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L628_C6", "label": "style =", "type": "assigned_variable", "loc": [628, 628], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4", "vector": [14, 4, 0.8946, 0.0014, 4, 0.18, 1.0, 3, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "style", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " style = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L630_C4", "label": "append()", "type": "expression", "loc": [630, 631], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [8, 2, 0.8981, 0.0028, 2, 0.8, 0.4286, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append('<tr><td class=\"udiff %s\" %s>%s</td></tr>' %\n (style, row1_id, cgi.escape(line_text)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L633_C4", "label": "frags =", "type": "assigned_variable", "loc": [633, 633], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [14, 2, 0.9017, 0.0014, 2, 0.8, 0.5714, 699, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "frags", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " frags = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "label": "if", "type": "if", "loc": [634, 648], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [4, 2, 0.9131, 0.0214, 2, 0.8, 0.7143, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_line_no in old_dict or new_line_no in new_dict:\n frags.append('<tr class=\"inline-comments\" name=\"hook\">')\n if old_line_no in old_dict:\n dct = old_dict\n line_no = old_line_no\n snapshot = 'old'\n else:\n dct = new_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L635_C6", "label": "append()", "type": "expression", "loc": [635, 635], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "vector": [8, 3, 0.9046, 0.0014, 3, 0.95, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr class=\"inline-comments\" name=\"hook\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "label": "if", "type": "if", "loc": [636, 643], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "vector": [4, 3, 0.911, 0.0114, 3, 0.95, 0.25, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if old_line_no in old_dict:\n dct = old_dict\n line_no = old_line_no\n snapshot = 'old'\n else:\n dct = new_dict\n line_no = new_line_no\n snapshot = 'new'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L637_C8", "label": "dct =", "type": "assigned_variable", "loc": [637, 637], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.9074, 0.0014, 4, 0.0, 0.0, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dct = old_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L638_C8", "label": "line_no =", "type": "assigned_variable", "loc": [638, 638], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.9088, 0.0014, 4, 0.0, 0.2, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line_no", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line_no = old_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L639_C8", "label": "snapshot =", "type": "assigned_variable", "loc": [639, 639], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.9103, 0.0014, 4, 0.0, 0.4, 260, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "snapshot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " snapshot = 'old'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L641_C8", "label": "dct =", "type": "assigned_variable", "loc": [641, 641], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.9131, 0.0014, 4, 0.0, 0.6, 751, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "dct", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dct = new_dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L642_C8", "label": "line_no =", "type": "assigned_variable", "loc": [642, 642], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.9145, 0.0014, 4, 0.0, 0.8, 966, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "line_no", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " line_no = new_line_no"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L643_C8", "label": "snapshot =", "type": "assigned_variable", "loc": [643, 643], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "vector": [14, 4, 0.916, 0.0014, 4, 0.0, 1.0, 260, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "snapshot", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " snapshot = 'new'"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L644_C6", "label": "append()", "type": "expression", "loc": [644, 645], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "vector": [8, 3, 0.9181, 0.0028, 3, 0.95, 0.5, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append(_RenderInlineComments(True, line_no, dct, request.user,\n request.patch, snapshot, snapshot, request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L647_C6", "label": "append()", "type": "expression", "loc": [647, 647], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "vector": [8, 3, 0.9217, 0.0014, 3, 0.95, 0.75, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<tr class=\"inline-comments\">')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L648_C6", "label": "append()", "type": "expression", "loc": [648, 648], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "vector": [8, 3, 0.9231, 0.0014, 3, 0.95, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('<td ' + row2_id +'></td>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L649_C4", "label": "append()", "type": "expression", "loc": [649, 649], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [8, 2, 0.9245, 0.0014, 2, 0.8, 0.8571, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " frags.append('</tr>')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L650_C4", "label": "append()", "type": "expression", "loc": [650, 650], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "vector": [8, 2, 0.9259, 0.0014, 2, 0.8, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " rows.append(''.join(frags))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L651_C2", "label": "return", "type": "return", "loc": [651, 651], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "vector": [13, 1, 0.9274, 0.0014, 1, 0.24, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return rows"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "label": "_ComputeLineCounts", "type": "function", "loc": [654, 672], "level": 0, "parent": null, "vector": [2, 0, 0.9444, 0.0271, 0, 0.66, 0.9286, 555, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "_ComputeLineCounts", "arg_names": ["old_lines", "chunks"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _ComputeLineCounts(old_lines, chunks):\n \"\"\"Compute the length of the old and new sides of a diff.\n\n Args:\n old_lines: List of lines representing the original file.\n chunks: List of chunks as returned by patching.ParsePatchToChunks().\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L655_C2", "label": "expression", "type": "expression", "loc": [655, 666], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "vector": [8, 1, 0.9409, 0.0171, 1, 0.21, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Compute the length of the old and new sides of a diff.\n\n Args:\n old_lines: List of lines representing the original file.\n chunks: List of chunks as returned by patching.ParsePatchToChunks().\n\n Returns:\n A tuple (old_len, new_len) representing len(old_lines) and"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L667_C2", "label": "old_len = len()", "type": "assigned_variable", "loc": [667, 667], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "vector": [14, 1, 0.9501, 0.0014, 1, 0.21, 0.25, 903, 3, 1, 0, 0, 890, 10, 1], "semantic": {"name": "old_len", "arg_names": [], "import_names": [], "rhs_call_name": "len", "annotation": ""}, "snippet": " old_len = len(old_lines)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L668_C2", "label": "new_len =", "type": "assigned_variable", "loc": [668, 668], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "vector": [14, 1, 0.9516, 0.0014, 1, 0.21, 0.5, 917, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "new_len", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " new_len = old_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L669_C2", "label": "if", "type": "if", "loc": [669, 671], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "vector": [4, 1, 0.9544, 0.0043, 1, 0.21, 0.75, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if chunks:\n (_, old_b), (_, new_b), old_lines, _ = chunks[-1]\n new_len += new_b - old_b"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L670_C4", "label": "old_lines, _ =", "type": "assigned_variable", "loc": [670, 670], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L669_C2", "vector": [14, 2, 0.9544, 0.0014, 2, 0.89, 0.0, 709, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "old_lines, _", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " (_, old_b), (_, new_b), old_lines, _ = chunks[-1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L672_C2", "label": "return", "type": "return", "loc": [672, 672], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "vector": [13, 1, 0.9573, 0.0014, 1, 0.21, 1.0, 0, 0, 0, 0, 0, 0, 8, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return old_len, new_len"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "label": "_MarkupNumber", "type": "function", "loc": [675, 690], "level": 0, "parent": null, "vector": [2, 0, 0.9722, 0.0228, 0, 0.66, 0.9643, 524, 0, 3, 1, 0, 0, 0, 2], "semantic": {"name": "_MarkupNumber", "arg_names": ["ndigits", "number", "tag"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _MarkupNumber(ndigits, number, tag):\n \"\"\"Format a number in HTML in a given width with extra markup.\n\n Args:\n ndigits: the total width available for formatting\n number: the number to be formatted\n tag: HTML tag name, e.g. 'u'\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L676_C2", "label": "expression", "type": "expression", "loc": [676, 687], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "vector": [8, 1, 0.9708, 0.0171, 1, 0.37, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Format a number in HTML in a given width with extra markup.\n\n Args:\n ndigits: the total width available for formatting\n number: the number to be formatted\n tag: HTML tag name, e.g. 'u'\n\n Returns:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L688_C2", "label": "formatted_number = str()", "type": "assigned_variable", "loc": [688, 688], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "vector": [14, 1, 0.9801, 0.0014, 1, 0.37, 0.3333, 724, 3, 1, 0, 0, 52, 10, 1], "semantic": {"name": "formatted_number", "arg_names": [], "import_names": [], "rhs_call_name": "str", "annotation": ""}, "snippet": " formatted_number = str(number)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L689_C2", "label": "space_prefix =", "type": "assigned_variable", "loc": [689, 689], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "vector": [14, 1, 0.9815, 0.0014, 1, 0.37, 0.6667, 996, 4, 0, 0, 0, 0, 0, 1], "semantic": {"name": "space_prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " space_prefix = ' ' * (ndigits - len(formatted_number))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L690_C2", "label": "return", "type": "return", "loc": [690, 690], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "vector": [13, 1, 0.9829, 0.0014, 1, 0.37, 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</%s>' % (space_prefix, tag, formatted_number, tag)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "label": "_ExpandTemplate", "type": "function", "loc": [693, 700], "level": 0, "parent": null, "vector": [2, 0, 0.9922, 0.0114, 0, 0.66, 1.0, 868, 0, 3, 1, 0, 0, 0, 3], "semantic": {"name": "_ExpandTemplate", "arg_names": ["name", "request", "params"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def _ExpandTemplate(name, request, **params):\n \"\"\"Wrapper around django.template.loader.render_to_string().\n\n For convenience, this takes keyword arguments instead of a dict.\n \"\"\"\n rslt = loader.render_to_string(name, params,\n context_instance=RequestContext(request))\n return rslt.encode('utf-8')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L694_C2", "label": "expression", "type": "expression", "loc": [694, 697], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "vector": [8, 1, 0.9907, 0.0057, 1, 0.44, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Wrapper around django.template.loader.render_to_string().\n\n For convenience, this takes keyword arguments instead of a dict.\n \"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L698_C2", "label": "rslt = render_to_string()", "type": "assigned_variable", "loc": [698, 699], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "vector": [14, 1, 0.995, 0.0028, 1, 0.44, 0.5, 499, 3, 3, 0, 0, 851, 10, 2], "semantic": {"name": "rslt", "arg_names": [], "import_names": [], "rhs_call_name": "render_to_string", "annotation": ""}, "snippet": " rslt = loader.render_to_string(name, params,\n context_instance=RequestContext(request))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L700_C2", "label": "return", "type": "return", "loc": [700, 700], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "vector": [13, 1, 0.9972, 0.0014, 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 rslt.encode('utf-8')"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L49_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L50_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L52_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L56_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L57_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L57_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L61_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L62_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L64_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L46_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L66_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L66_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L68_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L33_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L108_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L110_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L116_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L134_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L113_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L136_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L140_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L150_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L153_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L156_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L156_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L157_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L152_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L158_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L159_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L151_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L160_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L160_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L161_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L139_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L163_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L163_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L164_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L164_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L165_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L168_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L169_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L168_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L183_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L183_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L184_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L186_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L188_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L189_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L189_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L190_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L187_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L191_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L192_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L193_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L194_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L194_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L195_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L199_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L201_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L201_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L202_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L207_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L211_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L182_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L219_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L219_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L220_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L225_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L233_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L234_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L235_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L235_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L239_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L241_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L242_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L237_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L243_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L223_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L244_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L251_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L262_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L250_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L263_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L263_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L264_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L268_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L277_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L278_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L284_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L286_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L288_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L287_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L290_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L282_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L291_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L292_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L297_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L305_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L306_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L307_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L307_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L308_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L309_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L295_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L310_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L320_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L339_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L340_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L341_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L342_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L343_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L348_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L347_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L350_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L352_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L351_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L354_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L355_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L346_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L358_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L359_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L359_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L360_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L361_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L361_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L362_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L363_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L357_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L365_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L365_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L366_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L316_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L371_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L370_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L372_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L373_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L374_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L375_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L376_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L377_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L378_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L379_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L380_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L384_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L385_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L386_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L387_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L390_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L393_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L391_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L395_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L396_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L398_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L399_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L400_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L400_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L401_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L402_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L402_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L403_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L405_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L382_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L409_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L410_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L413_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L415_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L417_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L419_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L421_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L421_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L428_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L406_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L429_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L369_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L434_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L435_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L436_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L438_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L439_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L440_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L442_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L446_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L450_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L450_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L451_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L452_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L452_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L453_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L455_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L455_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L462_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L463_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L431_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L464_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L472_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L473_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L475_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L477_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L478_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L479_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L467_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L482_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L483_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L484_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L485_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L486_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L488_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L490_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L495_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L500_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L503_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L505_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L504_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L508_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L510_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L509_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L513_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L502_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L514_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L521_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L518_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L523_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L526_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L531_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L516_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L536_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L481_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L539_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L542_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L544_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L542_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L550_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L552_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L551_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L554_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L556_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L559_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L559_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L560_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L555_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L562_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L563_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L549_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L566_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L571_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L576_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L578_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L579_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L579_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L580_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L592_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L577_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L594_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L569_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L595_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L599_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L609_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L611_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L613_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L617_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L618_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L616_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L620_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L619_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L621_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L624_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L623_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L626_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L625_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L628_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L630_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L633_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L635_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L637_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L638_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L639_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L641_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L642_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L636_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L643_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L644_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L647_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L634_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L648_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L649_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:For_L612_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L650_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L598_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L651_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L655_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L667_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L668_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L669_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:If_L669_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L670_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L654_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L672_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L676_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L688_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L689_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L675_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L690_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Expr_L694_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Assign_L698_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1191:FunctionDef_L693_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1191:Return_L700_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
import re
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
f = open(filename, 'r')
str = f.read()
if len(str) == 0:
return -1
str = re.sub("[!_?/\|<>{}():;,.@#$%^&*--+='~`]","",str)
str = str.lower().split()
ans = {"":[str[0]]}
index=0
for word in str[:-1]:
if ans.get(word):
ans[word].append(str[index+1])
else:
ans[word]=[str[index+1]]
index+=1
return ans
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
temp = ''
print word,
for i in range(200):
if mimic_dict.get(word) == None:
word = ''
temp = random.choice(mimic_dict[word])
print temp,
word = temp
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1194 | 38 | 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_1194:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2802, 0.3736, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Mimic pyquick exercise -- optional extra exercise.\nGoogle's Python Class\n\nRead in the file specified on the command line.\nDo a simple split() on whitespace to obtain all the words in the file.\nRather than read the file line by line, it's easier to read\nit into one giant string and split it once.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4835, 0.011, 0, 0.66, 0.1429, 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_1194:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4945, 0.011, 0, 0.66, 0.2857, 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_1194:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.5055, 0.011, 0, 0.66, 0.4286, 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_1194:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 64], "level": 0, "parent": null, "vector": [2, 0, 0.6154, 0.1868, 0, 0.66, 0.5714, 49, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "mimic_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mimic_dict(filename):\n \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\"\n f = open(filename, 'r')\n str = f.read()\n if len(str) == 0:\n return -1\n str = re.sub(\"[!_?/\\|<>{}():;,.@#$%^&*--+='~`]\",\"\",str)\n str = str.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [8, 1, 0.5385, 0.011, 1, 0.42, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.5495, 0.011, 1, 0.42, 0.1111, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L51_C2", "label": "str = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.5604, 0.011, 1, 0.42, 0.2222, 52, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L52_C2", "label": "if", "type": "if", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [4, 1, 0.5769, 0.022, 1, 0.42, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(str) == 0:\n return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L52_C2", "vector": [13, 2, 0.5824, 0.011, 2, 0.77, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L54_C2", "label": "str = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.5934, 0.011, 1, 0.42, 0.4444, 52, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str = re.sub(\"[!_?/\\|<>{}():;,.@#$%^&*--+='~`]\",\"\",str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L55_C2", "label": "str = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.6044, 0.011, 1, 0.42, 0.5556, 52, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " str = str.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L56_C2", "label": "ans =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.6154, 0.011, 1, 0.42, 0.6667, 276, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans = {\"\":[str[0]]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L57_C2", "label": "index =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [14, 1, 0.6264, 0.011, 1, 0.42, 0.7778, 780, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L58_C2", "label": "for word", "type": "for", "loc": [58, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [6, 1, 0.6648, 0.0659, 1, 0.42, 0.8889, 107, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in str[:-1]:\n if ans.get(word):\n ans[word].append(str[index+1])\n else:\n ans[word]=[str[index+1]]\n index+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4", "label": "if", "type": "if", "loc": [59, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L58_C2", "vector": [4, 2, 0.6648, 0.044, 2, 0.89, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ans.get(word):\n ans[word].append(str[index+1])\n else:\n ans[word]=[str[index+1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L60_C6", "label": "append()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4", "vector": [8, 3, 0.6593, 0.011, 3, 0.08, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans[word].append(str[index+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L62_C6", "label": "assign", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4", "vector": [14, 3, 0.6813, 0.011, 3, 0.08, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans[word]=[str[index+1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L64_C2", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "vector": [13, 1, 0.7033, 0.011, 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 ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "label": "print_mimic", "type": "function", "loc": [67, 77], "level": 0, "parent": null, "vector": [2, 0, 0.7912, 0.1209, 0, 0.66, 0.7143, 927, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print_mimic", "arg_names": ["mimic_dict", "word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_mimic(mimic_dict, word):\n \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\"\n temp = ''\n print(word,)\n for i in range(200):\n if mimic_dict.get(word) == None:\n word = ''\n temp = random.choice(mimic_dict[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L68_C2", "label": "expression", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "vector": [8, 1, 0.7473, 0.011, 1, 0.34, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L69_C2", "label": "temp =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "vector": [14, 1, 0.7582, 0.011, 1, 0.34, 0.25, 915, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L70_C2", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "vector": [8, 1, 0.7692, 0.011, 1, 0.34, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "label": "for i", "type": "for", "loc": [71, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "vector": [6, 1, 0.8077, 0.0659, 1, 0.34, 0.75, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(200):\n if mimic_dict.get(word) == None:\n word = ''\n temp = random.choice(mimic_dict[word])\n print(temp,)\n word = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L72_C4", "label": "if", "type": "if", "loc": [72, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "vector": [4, 2, 0.7967, 0.022, 2, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic_dict.get(word) == None:\n word = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L73_C6", "label": "word =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L72_C4", "vector": [14, 3, 0.8022, 0.011, 3, 0.29, 0.0, 107, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L74_C4", "label": "temp = choice()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "vector": [14, 2, 0.8132, 0.011, 2, 0.37, 0.3333, 915, 3, 1, 0, 0, 30, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " temp = random.choice(mimic_dict[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L75_C4", "label": "print()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "vector": [8, 2, 0.8242, 0.011, 2, 0.37, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(temp,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L76_C4", "label": "word =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "vector": [14, 2, 0.8352, 0.011, 2, 0.37, 1.0, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L77_C2", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "vector": [13, 1, 0.8462, 0.011, 1, 0.34, 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_1194:FunctionDef_L81_C0", "label": "main", "type": "function", "loc": [81, 87], "level": 0, "parent": null, "vector": [2, 0, 0.9231, 0.0769, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)\n\n dict = mimic_dict(sys.argv[1])\n print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2", "label": "if", "type": "if", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "vector": [4, 1, 0.9121, 0.033, 1, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L83_C4", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2", "vector": [8, 2, 0.9121, 0.011, 2, 0.76, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L84_C4", "label": "exit()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2", "vector": [8, 2, 0.9231, 0.011, 2, 0.76, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L86_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "vector": [14, 1, 0.9451, 0.011, 1, 0.98, 0.5, 827, 3, 1, 0, 0, 49, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "mimic_dict", "annotation": ""}, "snippet": " dict = mimic_dict(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L87_C2", "label": "print_mimic()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "vector": [8, 1, 0.956, 0.011, 1, 0.98, 1.0, 927, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print_mimic", "arg_names": [], "import_names": [], "rhs_call_name": "print_mimic", "annotation": ""}, "snippet": " print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L90_C0", "label": "if", "type": "if", "loc": [90, 91], "level": 0, "parent": null, "vector": [4, 0, 0.9945, 0.022, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L91_C2", "label": "main()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L90_C0", "vector": [8, 1, 1.0, 0.011, 1, 0.29, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Return_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1194:If_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1194:Expr_L91_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
ans=[]
i=0
while i < len(nums):
if nums[i] != nums[i-1]:
ans.append(nums[i])
i+=1
return ans
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
ans=[]
i=0
j=0
while i+j < len(list1)+len(list2):
if i < len(list1) and j < len(list2):
if list1[i] < list2[j]:
ans.append(list1[i])
i+=1
else:
ans.append(list2[j])
j+=1
elif j >= len(list2):
ans.append(list1[i])
i+=1
else:
ans.append(list2[j])
j+=1
return ans
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1198 | 35 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2202, 0.0952, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n ans=[]\n i=0\n while i < len(nums):\n if nums[i] != nums[i-1]:\n ans.append(nums[i])\n i+=1\n return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L16_C2", "label": "ans =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "vector": [14, 1, 0.1905, 0.0119, 1, 0.37, 0.0, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L17_C2", "label": "i =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "vector": [14, 1, 0.2024, 0.0119, 1, 0.37, 0.3333, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L18_C2", "label": "while", "type": "while", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "vector": [5, 1, 0.2321, 0.0476, 1, 0.37, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while i < len(nums):\n if nums[i] != nums[i-1]:\n ans.append(nums[i])\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L18_C2", "vector": [4, 2, 0.2321, 0.0238, 2, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nums[i] != nums[i-1]:\n ans.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L20_C6", "label": "append()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L19_C4", "vector": [8, 3, 0.2381, 0.0119, 3, 0.91, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Return_L22_C2", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "vector": [13, 1, 0.2619, 0.0119, 1, 0.37, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "label": "linear_merge", "type": "function", "loc": [29, 47], "level": 0, "parent": null, "vector": [2, 0, 0.4524, 0.2262, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n ans=[]\n i=0\n j=0\n while i+j < len(list1)+len(list2):\n if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L30_C2", "label": "ans =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "vector": [14, 1, 0.3571, 0.0119, 1, 0.25, 0.0, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L31_C2", "label": "i =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "vector": [14, 1, 0.369, 0.0119, 1, 0.25, 0.25, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L32_C2", "label": "j =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "vector": [14, 1, 0.381, 0.0119, 1, 0.25, 0.5, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L33_C2", "label": "while", "type": "while", "loc": [33, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "vector": [5, 1, 0.4702, 0.1667, 1, 0.25, 0.75, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while i+j < len(list1)+len(list2):\n if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4", "label": "if", "type": "if", "loc": [34, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L33_C2", "vector": [4, 2, 0.4762, 0.1548, 2, 0.21, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1\n elif j >= len(list2): "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6", "label": "if", "type": "if", "loc": [35, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4", "vector": [4, 3, 0.4464, 0.0714, 3, 0.6, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L36_C8", "label": "append()", "type": "expression", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6", "vector": [8, 4, 0.4286, 0.0119, 4, 0.58, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L39_C8", "label": "append()", "type": "expression", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6", "vector": [8, 4, 0.4643, 0.0119, 4, 0.58, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list2[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4", "label": "if", "type": "if", "loc": [41, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4", "vector": [4, 3, 0.5179, 0.0714, 3, 0.6, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif j >= len(list2): \n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L42_C6", "label": "append()", "type": "expression", "loc": [42, 42], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4", "vector": [8, 4, 0.5, 0.0119, 4, 0.81, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L45_C6", "label": "append()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4", "vector": [8, 4, 0.5357, 0.0119, 4, 0.81, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list2[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Return_L47_C2", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "vector": [13, 1, 0.5595, 0.0119, 1, 0.25, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L60_C0", "label": "test", "type": "function", "loc": [60, 65], "level": 0, "parent": null, "vector": [2, 0, 0.744, 0.0714, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2", "label": "if", "type": "if", "loc": [61, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L60_C0", "vector": [4, 1, 0.744, 0.0476, 1, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L62_C4", "label": "prefix =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2", "vector": [14, 2, 0.7381, 0.0119, 2, 0.21, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L64_C4", "label": "prefix =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2", "vector": [14, 2, 0.7619, 0.0119, 2, 0.21, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L65_C2", "label": "print()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L60_C0", "vector": [8, 1, 0.7738, 0.0119, 1, 0.37, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "label": "main", "type": "function", "loc": [69, 80], "level": 0, "parent": null, "vector": [2, 0, 0.8869, 0.1429, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L70_C2", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.8333, 0.0119, 1, 0.23, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L71_C2", "label": "test()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.8452, 0.0119, 1, 0.23, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L72_C2", "label": "test()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.8571, 0.0119, 1, 0.23, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.869, 0.0119, 1, 0.23, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L75_C2", "label": "test()", "type": "expression", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.8988, 0.0238, 1, 0.23, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L77_C2", "label": "test()", "type": "expression", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.9226, 0.0238, 1, 0.23, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L79_C2", "label": "test()", "type": "expression", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "vector": [8, 1, 0.9464, 0.0238, 1, 0.23, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L83_C0", "label": "if", "type": "if", "loc": [83, 84], "level": 0, "parent": null, "vector": [4, 0, 0.994, 0.0238, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L84_C2", "label": "main()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L83_C0", "vector": [8, 1, 1.0, 0.0119, 1, 0.23, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Return_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:While_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L35_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L45_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Return_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1198:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1198:Expr_L84_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
def read_file(filename):
f = open(filename, 'r')
ans=[]
buf = ''
temp= ''
for line in f:
for i in line:
if i == ' ' or i == '\n':
buf = buf.lower()
ans += buf.split()
buf=''
else:
buf += i
f.close
dict = {}
for i in ans:
if i in dict:
dict[i]+=1
else:
dict[i]=1
return dict
def print_words(filename):
f = read_file(filename)
for key in sorted(f.keys(), reverse = True, key=f.get):
print key,' ', f.get(key)
def print_top(filename):
dict = read_file(filename)
count=0
for i in sorted(dict.keys(), reverse = True, key=dict.get):
if count < len(dict) and count < 20:
print i, dict.get(i)
count+=1
else:
break
# +++your code here+++
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1199 | 42 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2238, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.381, 0.0095, 0, 0.66, 0.1667, 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_1199:FunctionDef_L42_C0", "label": "read_file", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.4952, 0.2, 0, 0.66, 0.3333, 542, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "read_file", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_file(filename):\n f = open(filename, 'r')\n ans=[]\n buf = ''\n temp= ''\n for line in f:\n for i in line:\n if i == ' ' or i == '\\n':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L43_C2", "label": "f = open()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [14, 1, 0.4095, 0.0095, 1, 0.28, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L44_C2", "label": "ans =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [14, 1, 0.419, 0.0095, 1, 0.28, 0.125, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L45_C2", "label": "buf =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [14, 1, 0.4286, 0.0095, 1, 0.28, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L46_C2", "label": "temp =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [14, 1, 0.4381, 0.0095, 1, 0.28, 0.375, 915, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp= ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L47_C2", "label": "for line", "type": "for", "loc": [47, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [6, 1, 0.481, 0.0762, 1, 0.28, 0.5, 373, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n for i in line:\n if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L48_C4", "label": "for i", "type": "for", "loc": [48, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L47_C2", "vector": [6, 2, 0.4857, 0.0667, 2, 0.14, 0.0, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in line:\n if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6", "label": "if", "type": "if", "loc": [49, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L48_C4", "vector": [4, 3, 0.4905, 0.0571, 3, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L50_C8", "label": "buf = lower()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6", "vector": [14, 4, 0.4762, 0.0095, 4, 0.35, 0.0, 840, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " buf = buf.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L52_C8", "label": "buf =", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6", "vector": [14, 4, 0.4952, 0.0095, 4, 0.35, 1.0, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [8, 1, 0.5238, 0.0095, 1, 0.28, 0.625, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.close"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L56_C2", "label": "dict =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [14, 1, 0.5333, 0.0095, 1, 0.28, 0.75, 827, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L57_C2", "label": "for i", "type": "for", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [6, 1, 0.5619, 0.0476, 1, 0.28, 0.875, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in ans:\n if i in dict:\n dict[i]+=1\n else:\n dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L58_C4", "label": "if", "type": "if", "loc": [58, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L57_C2", "vector": [4, 2, 0.5667, 0.0381, 2, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i in dict:\n dict[i]+=1\n else:\n dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L61_C6", "label": "assign", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L58_C4", "vector": [14, 3, 0.581, 0.0095, 3, 0.72, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "vector": [13, 1, 0.5905, 0.0095, 1, 0.28, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L64_C0", "label": "print_words", "type": "function", "loc": [64, 67], "level": 0, "parent": null, "vector": [2, 0, 0.6238, 0.0381, 0, 0.66, 0.5, 267, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n f = read_file(filename)\n for key in sorted(f.keys(), reverse = True, key=f.get):\n print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L65_C2", "label": "f = read_file()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L64_C0", "vector": [14, 1, 0.619, 0.0095, 1, 0.81, 0.0, 899, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " f = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L66_C2", "label": "for key", "type": "for", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L64_C0", "vector": [6, 1, 0.6333, 0.019, 1, 0.81, 1.0, 230, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in sorted(f.keys(), reverse = True, key=f.get):\n print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L67_C4", "label": "print()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L66_C2", "vector": [8, 2, 0.6381, 0.0095, 2, 0.86, 0.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "label": "print_top", "type": "function", "loc": [69, 77], "level": 0, "parent": null, "vector": [2, 0, 0.6952, 0.0857, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n dict = read_file(filename)\n count=0\n for i in sorted(dict.keys(), reverse = True, key=dict.get):\n if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L70_C2", "label": "dict = read_file()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "vector": [14, 1, 0.6667, 0.0095, 1, 0.15, 0.0, 827, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " dict = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L71_C2", "label": "count =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "vector": [14, 1, 0.6762, 0.0095, 1, 0.15, 0.5, 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_1199:For_L72_C2", "label": "for i", "type": "for", "loc": [72, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "vector": [6, 1, 0.7095, 0.0571, 1, 0.15, 1.0, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in sorted(dict.keys(), reverse = True, key=dict.get):\n if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L73_C4", "label": "if", "type": "if", "loc": [73, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L72_C2", "vector": [4, 2, 0.7143, 0.0476, 2, 0.12, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L74_C6", "label": "print()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L73_C4", "vector": [8, 3, 0.7048, 0.0095, 3, 0.94, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i, dict.get(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "label": "main", "type": "function", "loc": [89, 102], "level": 0, "parent": null, "vector": [2, 0, 0.9095, 0.1333, 0, 0.66, 0.8333, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2", "label": "if", "type": "if", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "vector": [4, 1, 0.8667, 0.0286, 1, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L91_C4", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2", "vector": [8, 2, 0.8667, 0.0095, 2, 0.12, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L92_C4", "label": "exit()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2", "vector": [8, 2, 0.8762, 0.0095, 2, 0.12, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L94_C2", "label": "option =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "vector": [14, 1, 0.8952, 0.0095, 1, 0.51, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L95_C2", "label": "filename =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "vector": [14, 1, 0.9048, 0.0095, 1, 0.51, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2", "label": "if", "type": "if", "loc": [96, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "vector": [4, 1, 0.9429, 0.0667, 1, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L97_C4", "label": "print_words()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2", "vector": [8, 2, 0.9238, 0.0095, 2, 0.65, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "label": "if", "type": "if", "loc": [98, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2", "vector": [4, 2, 0.9524, 0.0476, 2, 0.65, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L99_C4", "label": "print_top()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "vector": [8, 3, 0.9429, 0.0095, 3, 0.41, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L101_C4", "label": "print()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "vector": [8, 3, 0.9619, 0.0095, 3, 0.41, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L102_C4", "label": "exit()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "vector": [8, 3, 0.9714, 0.0095, 3, 0.41, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L104_C0", "label": "if", "type": "if", "loc": [104, 105], "level": 0, "parent": null, "vector": [4, 0, 0.9952, 0.019, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L105_C2", "label": "main()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L104_C0", "vector": [8, 1, 1.0, 0.0095, 1, 0.11, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L49_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:For_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1199:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1199:Expr_L105_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
import re
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
f = open(filename, 'r')
str = f.read()
if len(str) == 0:
return -1
str = re.sub("[!_?/\|<>{}():;,.@#$%^&*--+='~`]","",str)
str = str.lower().split()
ans = {"":[str[0]]}
index=0
for word in str[:-1]:
if ans.get(word):
ans[word].append(str[index+1])
else:
ans[word]=[str[index+1]]
index+=1
return ans
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
temp = ''
print word,
for i in range(200):
if mimic_dict.get(word) == None:
word = ''
temp = random.choice(mimic_dict[word])
print temp,
word = temp
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1200 | 38 | 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_1200:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2802, 0.3736, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Mimic pyquick exercise -- optional extra exercise.\nGoogle's Python Class\n\nRead in the file specified on the command line.\nDo a simple split() on whitespace to obtain all the words in the file.\nRather than read the file line by line, it's easier to read\nit into one giant string and split it once.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4835, 0.011, 0, 0.66, 0.1429, 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_1200:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4945, 0.011, 0, 0.66, 0.2857, 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_1200:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.5055, 0.011, 0, 0.66, 0.4286, 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_1200:FunctionDef_L48_C0", "label": "mimic_dict", "type": "function", "loc": [48, 64], "level": 0, "parent": null, "vector": [2, 0, 0.6154, 0.1868, 0, 0.66, 0.5714, 49, 0, 1, 1, 0, 0, 0, 8], "semantic": {"name": "mimic_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mimic_dict(filename):\n \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\"\n f = open(filename, 'r')\n str = f.read()\n if len(str) == 0:\n return -1\n str = re.sub(\"[!_?/\\|<>{}():;,.@#$%^&*--+='~`]\",\"\",str)\n str = str.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L49_C2", "label": "expression", "type": "expression", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [8, 1, 0.5385, 0.011, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.5495, 0.011, 1, 0.76, 0.1111, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L51_C2", "label": "str = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.5604, 0.011, 1, 0.76, 0.2222, 52, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L52_C2", "label": "if", "type": "if", "loc": [52, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [4, 1, 0.5769, 0.022, 1, 0.76, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(str) == 0:\n return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L53_C4", "label": "return", "type": "return", "loc": [53, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L52_C2", "vector": [13, 2, 0.5824, 0.011, 2, 0.63, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return -1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L54_C2", "label": "str = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.5934, 0.011, 1, 0.76, 0.4444, 52, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str = re.sub(\"[!_?/\\|<>{}():;,.@#$%^&*--+='~`]\",\"\",str)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L55_C2", "label": "str = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.6044, 0.011, 1, 0.76, 0.5556, 52, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "str", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " str = str.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L56_C2", "label": "ans =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.6154, 0.011, 1, 0.76, 0.6667, 276, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans = {\"\":[str[0]]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L57_C2", "label": "index =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [14, 1, 0.6264, 0.011, 1, 0.76, 0.7778, 780, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "index", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " index=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L58_C2", "label": "for word", "type": "for", "loc": [58, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [6, 1, 0.6648, 0.0659, 1, 0.76, 0.8889, 107, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in str[:-1]:\n if ans.get(word):\n ans[word].append(str[index+1])\n else:\n ans[word]=[str[index+1]]\n index+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4", "label": "if", "type": "if", "loc": [59, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L58_C2", "vector": [4, 2, 0.6648, 0.044, 2, 0.23, 0.0, 0, 3, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if ans.get(word):\n ans[word].append(str[index+1])\n else:\n ans[word]=[str[index+1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L60_C6", "label": "append()", "type": "expression", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4", "vector": [8, 3, 0.6593, 0.011, 3, 0.11, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans[word].append(str[index+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L62_C6", "label": "assign", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4", "vector": [14, 3, 0.6813, 0.011, 3, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans[word]=[str[index+1]]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L64_C2", "label": "return", "type": "return", "loc": [64, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "vector": [13, 1, 0.7033, 0.011, 1, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "label": "print_mimic", "type": "function", "loc": [67, 77], "level": 0, "parent": null, "vector": [2, 0, 0.7912, 0.1209, 0, 0.66, 0.7143, 927, 0, 2, 0, 0, 0, 0, 5], "semantic": {"name": "print_mimic", "arg_names": ["mimic_dict", "word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_mimic(mimic_dict, word):\n \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\"\n temp = ''\n print(word,)\n for i in range(200):\n if mimic_dict.get(word) == None:\n word = ''\n temp = random.choice(mimic_dict[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L68_C2", "label": "expression", "type": "expression", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "vector": [8, 1, 0.7473, 0.011, 1, 0.64, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L69_C2", "label": "temp =", "type": "assigned_variable", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "vector": [14, 1, 0.7582, 0.011, 1, 0.64, 0.25, 915, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L70_C2", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "vector": [8, 1, 0.7692, 0.011, 1, 0.64, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(word,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "label": "for i", "type": "for", "loc": [71, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "vector": [6, 1, 0.8077, 0.0659, 1, 0.64, 0.75, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(200):\n if mimic_dict.get(word) == None:\n word = ''\n temp = random.choice(mimic_dict[word])\n print(temp,)\n word = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L72_C4", "label": "if", "type": "if", "loc": [72, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "vector": [4, 2, 0.7967, 0.022, 2, 0.15, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic_dict.get(word) == None:\n word = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L73_C6", "label": "word =", "type": "assigned_variable", "loc": [73, 73], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L72_C4", "vector": [14, 3, 0.8022, 0.011, 3, 0.89, 0.0, 107, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L74_C4", "label": "temp = choice()", "type": "assigned_variable", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "vector": [14, 2, 0.8132, 0.011, 2, 0.15, 0.3333, 915, 3, 1, 0, 0, 30, 10, 1], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " temp = random.choice(mimic_dict[word])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L75_C4", "label": "print()", "type": "expression", "loc": [75, 75], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "vector": [8, 2, 0.8242, 0.011, 2, 0.15, 0.6667, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(temp,)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L76_C4", "label": "word =", "type": "assigned_variable", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "vector": [14, 2, 0.8352, 0.011, 2, 0.15, 1.0, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " word = temp"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L77_C2", "label": "return", "type": "return", "loc": [77, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "vector": [13, 1, 0.8462, 0.011, 1, 0.64, 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_1200:FunctionDef_L81_C0", "label": "main", "type": "function", "loc": [81, 87], "level": 0, "parent": null, "vector": [2, 0, 0.9231, 0.0769, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)\n\n dict = mimic_dict(sys.argv[1])\n print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2", "label": "if", "type": "if", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "vector": [4, 1, 0.9121, 0.033, 1, 0.98, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L83_C4", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2", "vector": [8, 2, 0.9121, 0.011, 2, 0.9, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L84_C4", "label": "exit()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2", "vector": [8, 2, 0.9231, 0.011, 2, 0.9, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L86_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "vector": [14, 1, 0.9451, 0.011, 1, 0.98, 0.5, 827, 3, 1, 0, 0, 49, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "mimic_dict", "annotation": ""}, "snippet": " dict = mimic_dict(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L87_C2", "label": "print_mimic()", "type": "expression", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "vector": [8, 1, 0.956, 0.011, 1, 0.98, 1.0, 927, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print_mimic", "arg_names": [], "import_names": [], "rhs_call_name": "print_mimic", "annotation": ""}, "snippet": " print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L90_C0", "label": "if", "type": "if", "loc": [90, 91], "level": 0, "parent": null, "vector": [4, 0, 0.9945, 0.022, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L91_C2", "label": "main()", "type": "expression", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L90_C0", "vector": [8, 1, 1.0, 0.011, 1, 0.22, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L52_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L53_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L58_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L59_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L72_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L73_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:For_L71_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L67_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Return_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1200:If_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1200:Expr_L91_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
ans=[]
i=0
while i < len(nums):
if nums[i] != nums[i-1]:
ans.append(nums[i])
i+=1
return ans
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
ans=[]
i=0
j=0
while i+j < len(list1)+len(list2):
if i < len(list1) and j < len(list2):
if list1[i] < list2[j]:
ans.append(list1[i])
i+=1
else:
ans.append(list2[j])
j+=1
elif j >= len(list2):
ans.append(list1[i])
i+=1
else:
ans.append(list2[j])
j+=1
return ans
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1202 | 35 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 22], "level": 0, "parent": null, "vector": [2, 0, 0.2202, 0.0952, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n ans=[]\n i=0\n while i < len(nums):\n if nums[i] != nums[i-1]:\n ans.append(nums[i])\n i+=1\n return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L16_C2", "label": "ans =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "vector": [14, 1, 0.1905, 0.0119, 1, 0.96, 0.0, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L17_C2", "label": "i =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "vector": [14, 1, 0.2024, 0.0119, 1, 0.96, 0.3333, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L18_C2", "label": "while", "type": "while", "loc": [18, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "vector": [5, 1, 0.2321, 0.0476, 1, 0.96, 0.6667, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while i < len(nums):\n if nums[i] != nums[i-1]:\n ans.append(nums[i])\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L18_C2", "vector": [4, 2, 0.2321, 0.0238, 2, 0.42, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nums[i] != nums[i-1]:\n ans.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L20_C6", "label": "append()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L19_C4", "vector": [8, 3, 0.2381, 0.0119, 3, 0.25, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Return_L22_C2", "label": "return", "type": "return", "loc": [22, 22], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "vector": [13, 1, 0.2619, 0.0119, 1, 0.96, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "label": "linear_merge", "type": "function", "loc": [29, 47], "level": 0, "parent": null, "vector": [2, 0, 0.4524, 0.2262, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 9], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n ans=[]\n i=0\n j=0\n while i+j < len(list1)+len(list2):\n if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L30_C2", "label": "ans =", "type": "assigned_variable", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "vector": [14, 1, 0.3571, 0.0119, 1, 0.29, 0.0, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L31_C2", "label": "i =", "type": "assigned_variable", "loc": [31, 31], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "vector": [14, 1, 0.369, 0.0119, 1, 0.29, 0.25, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L32_C2", "label": "j =", "type": "assigned_variable", "loc": [32, 32], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "vector": [14, 1, 0.381, 0.0119, 1, 0.29, 0.5, 100, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L33_C2", "label": "while", "type": "while", "loc": [33, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "vector": [5, 1, 0.4702, 0.1667, 1, 0.29, 0.75, 0, 0, 0, 0, 0, 0, 0, 9], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " while i+j < len(list1)+len(list2):\n if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4", "label": "if", "type": "if", "loc": [34, 46], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L33_C2", "vector": [4, 2, 0.4762, 0.1548, 2, 0.17, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i < len(list1) and j < len(list2):\n if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1\n elif j >= len(list2): "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6", "label": "if", "type": "if", "loc": [35, 40], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4", "vector": [4, 3, 0.4464, 0.0714, 3, 0.86, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if list1[i] < list2[j]:\n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L36_C8", "label": "append()", "type": "expression", "loc": [36, 36], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6", "vector": [8, 4, 0.4286, 0.0119, 4, 0.02, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L39_C8", "label": "append()", "type": "expression", "loc": [39, 39], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6", "vector": [8, 4, 0.4643, 0.0119, 4, 0.02, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list2[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4", "label": "if", "type": "if", "loc": [41, 46], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4", "vector": [4, 3, 0.5179, 0.0714, 3, 0.86, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif j >= len(list2): \n ans.append(list1[i])\n i+=1\n else:\n ans.append(list2[j])\n j+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L42_C6", "label": "append()", "type": "expression", "loc": [42, 42], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4", "vector": [8, 4, 0.5, 0.0119, 4, 0.44, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list1[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L45_C6", "label": "append()", "type": "expression", "loc": [45, 45], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4", "vector": [8, 4, 0.5357, 0.0119, 4, 0.44, 1.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " ans.append(list2[j])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Return_L47_C2", "label": "return", "type": "return", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "vector": [13, 1, 0.5595, 0.0119, 1, 0.29, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return ans"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L60_C0", "label": "test", "type": "function", "loc": [60, 65], "level": 0, "parent": null, "vector": [2, 0, 0.744, 0.0714, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2", "label": "if", "type": "if", "loc": [61, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L60_C0", "vector": [4, 1, 0.744, 0.0476, 1, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L62_C4", "label": "prefix =", "type": "assigned_variable", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2", "vector": [14, 2, 0.7381, 0.0119, 2, 0.5, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L64_C4", "label": "prefix =", "type": "assigned_variable", "loc": [64, 64], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2", "vector": [14, 2, 0.7619, 0.0119, 2, 0.5, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L65_C2", "label": "print()", "type": "expression", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L60_C0", "vector": [8, 1, 0.7738, 0.0119, 1, 0.03, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "label": "main", "type": "function", "loc": [69, 80], "level": 0, "parent": null, "vector": [2, 0, 0.8869, 0.1429, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L70_C2", "label": "print()", "type": "expression", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.8333, 0.0119, 1, 0.37, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L71_C2", "label": "test()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.8452, 0.0119, 1, 0.37, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L72_C2", "label": "test()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.8571, 0.0119, 1, 0.37, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L73_C2", "label": "test()", "type": "expression", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.869, 0.0119, 1, 0.37, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L75_C2", "label": "test()", "type": "expression", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.8988, 0.0238, 1, 0.37, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L77_C2", "label": "test()", "type": "expression", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.9226, 0.0238, 1, 0.37, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L79_C2", "label": "test()", "type": "expression", "loc": [79, 80], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "vector": [8, 1, 0.9464, 0.0238, 1, 0.37, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L83_C0", "label": "if", "type": "if", "loc": [83, 84], "level": 0, "parent": null, "vector": [4, 0, 0.994, 0.0238, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L84_C2", "label": "main()", "type": "expression", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L83_C0", "vector": [8, 1, 1.0, 0.0119, 1, 0.06, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Return_L22_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L31_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L32_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:While_L33_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L36_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L35_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L39_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L34_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L42_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L45_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Return_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Assign_L64_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L60_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L73_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L77_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L79_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1202:If_L83_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1202:Expr_L84_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
def read_file(filename):
f = open(filename, 'r')
ans=[]
buf = ''
temp= ''
for line in f:
for i in line:
if i == ' ' or i == '\n':
buf = buf.lower()
ans += buf.split()
buf=''
else:
buf += i
f.close
dict = {}
for i in ans:
if i in dict:
dict[i]+=1
else:
dict[i]=1
return dict
def print_words(filename):
f = read_file(filename)
for key in sorted(f.keys(), reverse = True, key=f.get):
print key,' ', f.get(key)
def print_top(filename):
dict = read_file(filename)
count=0
for i in sorted(dict.keys(), reverse = True, key=dict.get):
if count < len(dict) and count < 20:
print i, dict.get(i)
count+=1
else:
break
# +++your code here+++
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1203 | 42 | 105 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2238, 0.2857, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.381, 0.0095, 0, 0.66, 0.1667, 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_1203:FunctionDef_L42_C0", "label": "read_file", "type": "function", "loc": [42, 62], "level": 0, "parent": null, "vector": [2, 0, 0.4952, 0.2, 0, 0.66, 0.3333, 542, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "read_file", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_file(filename):\n f = open(filename, 'r')\n ans=[]\n buf = ''\n temp= ''\n for line in f:\n for i in line:\n if i == ' ' or i == '\\n':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L43_C2", "label": "f = open()", "type": "assigned_variable", "loc": [43, 43], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [14, 1, 0.4095, 0.0095, 1, 0.48, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f = open(filename, 'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L44_C2", "label": "ans =", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [14, 1, 0.419, 0.0095, 1, 0.48, 0.125, 276, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "ans", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " ans=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L45_C2", "label": "buf =", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [14, 1, 0.4286, 0.0095, 1, 0.48, 0.25, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf = ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L46_C2", "label": "temp =", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [14, 1, 0.4381, 0.0095, 1, 0.48, 0.375, 915, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " temp= ''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L47_C2", "label": "for line", "type": "for", "loc": [47, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [6, 1, 0.481, 0.0762, 1, 0.48, 0.5, 373, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "line", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for line in f:\n for i in line:\n if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L48_C4", "label": "for i", "type": "for", "loc": [48, 54], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L47_C2", "vector": [6, 2, 0.4857, 0.0667, 2, 0.84, 0.0, 826, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in line:\n if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6", "label": "if", "type": "if", "loc": [49, 54], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L48_C4", "vector": [4, 3, 0.4905, 0.0571, 3, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i == ' ' or i == '\\n':\n buf = buf.lower()\n ans += buf.split()\n buf=''\n else:\n buf += i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L50_C8", "label": "buf = lower()", "type": "assigned_variable", "loc": [50, 50], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6", "vector": [14, 4, 0.4762, 0.0095, 4, 0.16, 0.0, 840, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " buf = buf.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L52_C8", "label": "buf =", "type": "assigned_variable", "loc": [52, 52], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6", "vector": [14, 4, 0.4952, 0.0095, 4, 0.16, 1.0, 840, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "buf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " buf=''"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L55_C2", "label": "expression", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [8, 1, 0.5238, 0.0095, 1, 0.48, 0.625, 0, 7, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " f.close"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L56_C2", "label": "dict =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [14, 1, 0.5333, 0.0095, 1, 0.48, 0.75, 827, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L57_C2", "label": "for i", "type": "for", "loc": [57, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [6, 1, 0.5619, 0.0476, 1, 0.48, 0.875, 826, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in ans:\n if i in dict:\n dict[i]+=1\n else:\n dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L58_C4", "label": "if", "type": "if", "loc": [58, 61], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L57_C2", "vector": [4, 2, 0.5667, 0.0381, 2, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i in dict:\n dict[i]+=1\n else:\n dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L61_C6", "label": "assign", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L58_C4", "vector": [14, 3, 0.581, 0.0095, 3, 0.0, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " dict[i]=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "vector": [13, 1, 0.5905, 0.0095, 1, 0.48, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return dict"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L64_C0", "label": "print_words", "type": "function", "loc": [64, 67], "level": 0, "parent": null, "vector": [2, 0, 0.6238, 0.0381, 0, 0.66, 0.5, 267, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n f = read_file(filename)\n for key in sorted(f.keys(), reverse = True, key=f.get):\n print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L65_C2", "label": "f = read_file()", "type": "assigned_variable", "loc": [65, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L64_C0", "vector": [14, 1, 0.619, 0.0095, 1, 0.21, 0.0, 899, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " f = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L66_C2", "label": "for key", "type": "for", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L64_C0", "vector": [6, 1, 0.6333, 0.019, 1, 0.21, 1.0, 230, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in sorted(f.keys(), reverse = True, key=f.get):\n print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L67_C4", "label": "print()", "type": "expression", "loc": [67, 67], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L66_C2", "vector": [8, 2, 0.6381, 0.0095, 2, 0.16, 0.0, 535, 3, 3, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(key,'\t', f.get(key))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "label": "print_top", "type": "function", "loc": [69, 77], "level": 0, "parent": null, "vector": [2, 0, 0.6952, 0.0857, 0, 0.66, 0.6667, 148, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n dict = read_file(filename)\n count=0\n for i in sorted(dict.keys(), reverse = True, key=dict.get):\n if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L70_C2", "label": "dict = read_file()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "vector": [14, 1, 0.6667, 0.0095, 1, 0.29, 0.0, 827, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " dict = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L71_C2", "label": "count =", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "vector": [14, 1, 0.6762, 0.0095, 1, 0.29, 0.5, 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_1203:For_L72_C2", "label": "for i", "type": "for", "loc": [72, 77], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "vector": [6, 1, 0.7095, 0.0571, 1, 0.29, 1.0, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in sorted(dict.keys(), reverse = True, key=dict.get):\n if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L73_C4", "label": "if", "type": "if", "loc": [73, 77], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L72_C2", "vector": [4, 2, 0.7143, 0.0476, 2, 0.46, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if count < len(dict) and count < 20:\n print(i, dict.get(i))\n count+=1\n else:\n break"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L74_C6", "label": "print()", "type": "expression", "loc": [74, 74], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L73_C4", "vector": [8, 3, 0.7048, 0.0095, 3, 0.67, 0.0, 535, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(i, dict.get(i))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "label": "main", "type": "function", "loc": [89, 102], "level": 0, "parent": null, "vector": [2, 0, 0.9095, 0.1333, 0, 0.66, 0.8333, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2", "label": "if", "type": "if", "loc": [90, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "vector": [4, 1, 0.8667, 0.0286, 1, 0.11, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L91_C4", "label": "print()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2", "vector": [8, 2, 0.8667, 0.0095, 2, 0.21, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L92_C4", "label": "exit()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2", "vector": [8, 2, 0.8762, 0.0095, 2, 0.21, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L94_C2", "label": "option =", "type": "assigned_variable", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "vector": [14, 1, 0.8952, 0.0095, 1, 0.11, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L95_C2", "label": "filename =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "vector": [14, 1, 0.9048, 0.0095, 1, 0.11, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2", "label": "if", "type": "if", "loc": [96, 102], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "vector": [4, 1, 0.9429, 0.0667, 1, 0.11, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L97_C4", "label": "print_words()", "type": "expression", "loc": [97, 97], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2", "vector": [8, 2, 0.9238, 0.0095, 2, 0.53, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "label": "if", "type": "if", "loc": [98, 102], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2", "vector": [4, 2, 0.9524, 0.0476, 2, 0.53, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L99_C4", "label": "print_top()", "type": "expression", "loc": [99, 99], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "vector": [8, 3, 0.9429, 0.0095, 3, 0.32, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L101_C4", "label": "print()", "type": "expression", "loc": [101, 101], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "vector": [8, 3, 0.9619, 0.0095, 3, 0.32, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L102_C4", "label": "exit()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "vector": [8, 3, 0.9714, 0.0095, 3, 0.32, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L104_C0", "label": "if", "type": "if", "loc": [104, 105], "level": 0, "parent": null, "vector": [4, 0, 0.9952, 0.019, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L105_C2", "label": "main()", "type": "expression", "loc": [105, 105], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L104_C0", "vector": [8, 1, 1.0, 0.0095, 1, 0.47, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L43_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L47_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L48_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L50_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L49_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L52_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L57_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L42_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L66_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L67_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:For_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L73_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L74_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:FunctionDef_L89_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L97_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L96_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L99_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L101_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L98_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1203:If_L104_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1203:Expr_L105_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
if nums == []:
return nums
last = nums[0]
mlist = []
mlist.append(last)
for i in nums[1:]:
if i!= last:
mlist.append(i)
last = i
return mlist
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
list1.extend(list2)
list1.sort()
return list1
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1209 | 30 | 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_1209:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 25], "level": 0, "parent": null, "vector": [2, 0, 0.2778, 0.1528, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n if nums == []:\n return nums\n last = nums[0]\n mlist = []\n mlist.append(last)\n for i in nums[1:]:\n if i!= last:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 1, 0.03, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nums == []:\n return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 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 nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.03, 0.2, 95, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = nums[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.03, 0.4, 76, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "mlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mlist = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.03, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " mlist.append(last)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.03, 0.8, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in nums[1:]:\n if i!= last:\n mlist.append(i)\n last = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2", "vector": [4, 2, 0.3125, 0.0278, 2, 0.24, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if i!= last:\n mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 0.37, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2", "vector": [14, 2, 0.3333, 0.0139, 2, 0.24, 1.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 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 mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "label": "linear_merge", "type": "function", "loc": [32, 35], "level": 0, "parent": null, "vector": [2, 0, 0.4653, 0.0556, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n list1.extend(list2)\n list1.sort()\n return list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.38, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " list1.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.38, 0.5, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " list1.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 1, 0.38, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L48_C0", "label": "test", "type": "function", "loc": [48, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7014, 0.0833, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.33, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.88, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.88, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.33, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "label": "main", "type": "function", "loc": [57, 68], "level": 0, "parent": null, "vector": [2, 0, 0.8681, 0.1667, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 0.01, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.01, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.01, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.01, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.01, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.01, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.01, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L71_C0", "label": "if", "type": "if", "loc": [71, 72], "level": 0, "parent": null, "vector": [4, 0, 0.9931, 0.0278, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 1, 0.15, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1209:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1209:Expr_L72_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
import re
# +++your code here+++
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
def read_file(filename):
f=open(filename,'r')
text = f.read()
text = re.sub("[/.,\';:?!-]","",text)
text = text.lower()
words = text.split()
wordsMap = {}
for word in words:
if word in wordsMap:
wordsMap[word] +=1
else:
wordsMap[word] = 1
return wordsMap
def print_words(filename):
wordsMap = read_file(filename)
keys=sorted(wordsMap.keys())
for key in keys:
print key, wordsMap[key]
return
def print_top(filename):
wordsMap = read_file(filename)
items=sorted(wordsMap.items(),key=lambda (k, v): v,reverse=True)
for item in items[:20]:
print item[0], item[1]
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1210 | 38 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2398, 0.3061, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4082, 0.0102, 0, 0.66, 0.1429, 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_1210:Import_L41_C0", "label": "re import re", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.4184, 0.0102, 0, 0.66, 0.2857, 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_1210:FunctionDef_L49_C0", "label": "read_file", "type": "function", "loc": [49, 62], "level": 0, "parent": null, "vector": [2, 0, 0.5663, 0.1429, 0, 0.66, 0.4286, 542, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "read_file", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_file(filename):\n f=open(filename,'r')\n text = f.read()\n text = re.sub(\"[/.,\\';:?!-]\",\"\",text)\n text = text.lower()\n words = text.split()\n wordsMap = {}\n for word in words:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.82, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.82, 0.1429, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.82, 0.2857, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text = re.sub(\"[/.,\\';:?!-]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.82, 0.4286, 439, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " text = text.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.82, 0.5714, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = text.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.82, 0.7143, 879, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wordsMap = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.82, 0.8571, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n if word in wordsMap:\n wordsMap[word] +=1\n else:\n wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 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 word in wordsMap:\n wordsMap[word] +=1\n else:\n wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.99, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 1, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordsMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "label": "print_words", "type": "function", "loc": [66, 71], "level": 0, "parent": null, "vector": [2, 0, 0.699, 0.0612, 0, 0.66, 0.5714, 267, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n wordsMap = read_file(filename)\n keys=sorted(wordsMap.keys())\n for key in keys:\n print(key, wordsMap[key])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.62, 0.0, 879, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " wordsMap = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.62, 0.3333, 204, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " keys=sorted(wordsMap.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.62, 0.6667, 230, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in keys:\n print(key, wordsMap[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L69_C2", "vector": [8, 2, 0.7143, 0.0102, 2, 0.85, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(key, wordsMap[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.62, 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_1210:FunctionDef_L73_C0", "label": "print_top", "type": "function", "loc": [73, 76], "level": 0, "parent": null, "vector": [2, 0, 0.7602, 0.0408, 0, 0.66, 0.7143, 148, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n wordsMap = read_file(filename)\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.74, 0.0, 879, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " wordsMap = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.74, 1.0, 434, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.62, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "label": "main", "type": "function", "loc": [82, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9031, 0.1429, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.36, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.82, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.82, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.36, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.36, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.36, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.51, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.51, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.86, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.86, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.86, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L97_C0", "label": "if", "type": "if", "loc": [97, 98], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0204, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.21, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1210:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1210:Expr_L98_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
if nums == []:
return nums
last = nums[0]
mlist = []
mlist.append(last)
for i in nums[1:]:
if i!= last:
mlist.append(i)
last = i
return mlist
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
list1.extend(list2)
list1.sort()
return list1
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1212 | 30 | 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_1212:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 25], "level": 0, "parent": null, "vector": [2, 0, 0.2778, 0.1528, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n if nums == []:\n return nums\n last = nums[0]\n mlist = []\n mlist.append(last)\n for i in nums[1:]:\n if i!= last:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L16_C2", "label": "if", "type": "if", "loc": [16, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [4, 1, 0.2292, 0.0278, 1, 0.14, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nums == []:\n return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L17_C4", "label": "return", "type": "return", "loc": [17, 17], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L16_C2", "vector": [13, 2, 0.2361, 0.0139, 2, 0.06, 0.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L18_C2", "label": "last =", "type": "assigned_variable", "loc": [18, 18], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [14, 1, 0.25, 0.0139, 1, 0.14, 0.2, 95, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = nums[0]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L19_C2", "label": "mlist =", "type": "assigned_variable", "loc": [19, 19], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [14, 1, 0.2639, 0.0139, 1, 0.14, 0.4, 76, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "mlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mlist = []"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L20_C2", "label": "append()", "type": "expression", "loc": [20, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [8, 1, 0.2778, 0.0139, 1, 0.14, 0.6, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " mlist.append(last)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2", "label": "for i", "type": "for", "loc": [21, 24], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [6, 1, 0.3125, 0.0556, 1, 0.14, 0.8, 826, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in nums[1:]:\n if i!= last:\n mlist.append(i)\n last = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L22_C4", "label": "if", "type": "if", "loc": [22, 23], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2", "vector": [4, 2, 0.3125, 0.0278, 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 i!= last:\n mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L23_C6", "label": "append()", "type": "expression", "loc": [23, 23], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L22_C4", "vector": [8, 3, 0.3194, 0.0139, 3, 0.15, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " mlist.append(i)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L24_C4", "label": "last =", "type": "assigned_variable", "loc": [24, 24], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2", "vector": [14, 2, 0.3333, 0.0139, 2, 0.0, 1.0, 95, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "last", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " last = i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L25_C2", "label": "return", "type": "return", "loc": [25, 25], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "vector": [13, 1, 0.3472, 0.0139, 1, 0.14, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "label": "linear_merge", "type": "function", "loc": [32, 35], "level": 0, "parent": null, "vector": [2, 0, 0.4653, 0.0556, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n list1.extend(list2)\n list1.sort()\n return list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L33_C2", "label": "extend()", "type": "expression", "loc": [33, 33], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "vector": [8, 1, 0.4583, 0.0139, 1, 0.82, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " list1.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L34_C2", "label": "sort()", "type": "expression", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "vector": [8, 1, 0.4722, 0.0139, 1, 0.82, 0.5, 489, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " list1.sort()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L35_C2", "label": "return", "type": "return", "loc": [35, 35], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "vector": [13, 1, 0.4861, 0.0139, 1, 0.82, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return list1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L48_C0", "label": "test", "type": "function", "loc": [48, 53], "level": 0, "parent": null, "vector": [2, 0, 0.7014, 0.0833, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2", "label": "if", "type": "if", "loc": [49, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L48_C0", "vector": [4, 1, 0.7014, 0.0556, 1, 0.51, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L50_C4", "label": "prefix =", "type": "assigned_variable", "loc": [50, 50], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2", "vector": [14, 2, 0.6944, 0.0139, 2, 0.89, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L52_C4", "label": "prefix =", "type": "assigned_variable", "loc": [52, 52], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2", "vector": [14, 2, 0.7222, 0.0139, 2, 0.89, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L48_C0", "vector": [8, 1, 0.7361, 0.0139, 1, 0.51, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "label": "main", "type": "function", "loc": [57, 68], "level": 0, "parent": null, "vector": [2, 0, 0.8681, 0.1667, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L58_C2", "label": "print()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.8056, 0.0139, 1, 0.66, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.8194, 0.0139, 1, 0.66, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.8333, 0.0139, 1, 0.66, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L61_C2", "label": "test()", "type": "expression", "loc": [61, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.8472, 0.0139, 1, 0.66, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L63_C2", "label": "test()", "type": "expression", "loc": [63, 64], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.8819, 0.0278, 1, 0.66, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L65_C2", "label": "test()", "type": "expression", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.9097, 0.0278, 1, 0.66, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L67_C2", "label": "test()", "type": "expression", "loc": [67, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "vector": [8, 1, 0.9375, 0.0278, 1, 0.66, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L71_C0", "label": "if", "type": "if", "loc": [71, 72], "level": 0, "parent": null, "vector": [4, 0, 0.9931, 0.0278, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L72_C2", "label": "main()", "type": "expression", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L71_C0", "vector": [8, 1, 1.0, 0.0139, 1, 0.43, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L16_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L19_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L20_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L22_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L22_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L23_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:For_L21_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L33_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L32_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Return_L35_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L49_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Assign_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L48_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L65_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:FunctionDef_L57_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1212:If_L71_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1212:Expr_L72_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
import re
# +++your code here+++
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
def read_file(filename):
f=open(filename,'r')
text = f.read()
text = re.sub("[/.,\';:?!-]","",text)
text = text.lower()
words = text.split()
wordsMap = {}
for word in words:
if word in wordsMap:
wordsMap[word] +=1
else:
wordsMap[word] = 1
return wordsMap
def print_words(filename):
wordsMap = read_file(filename)
keys=sorted(wordsMap.keys())
for key in keys:
print key, wordsMap[key]
return
def print_top(filename):
wordsMap = read_file(filename)
items=sorted(wordsMap.items(),key=lambda (k, v): v,reverse=True)
for item in items[:20]:
print item[0], item[1]
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1213 | 38 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2398, 0.3061, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4082, 0.0102, 0, 0.66, 0.1429, 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_1213:Import_L41_C0", "label": "re import re", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.4184, 0.0102, 0, 0.66, 0.2857, 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_1213:FunctionDef_L49_C0", "label": "read_file", "type": "function", "loc": [49, 62], "level": 0, "parent": null, "vector": [2, 0, 0.5663, 0.1429, 0, 0.66, 0.4286, 542, 0, 1, 1, 0, 0, 0, 5], "semantic": {"name": "read_file", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def read_file(filename):\n f=open(filename,'r')\n text = f.read()\n text = re.sub(\"[/.,\\';:?!-]\",\"\",text)\n text = text.lower()\n words = text.split()\n wordsMap = {}\n for word in words:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L50_C2", "label": "f = open()", "type": "assigned_variable", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.5102, 0.0102, 1, 0.18, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L51_C2", "label": "text = read()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.5204, 0.0102, 1, 0.18, 0.1429, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text = f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L52_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.18, 0.2857, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text = re.sub(\"[/.,\\';:?!-]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L53_C2", "label": "text = lower()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.18, 0.4286, 439, 3, 0, 0, 0, 432, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "lower", "annotation": ""}, "snippet": " text = text.lower()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L54_C2", "label": "words = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.18, 0.5714, 376, 3, 0, 0, 0, 908, 10, 1], "semantic": {"name": "words", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " words = text.split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L55_C2", "label": "wordsMap =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.18, 0.7143, 879, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wordsMap = {}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L56_C2", "label": "for word", "type": "for", "loc": [56, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [6, 1, 0.5918, 0.051, 1, 0.18, 0.8571, 107, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for word in words:\n if word in wordsMap:\n wordsMap[word] +=1\n else:\n wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L57_C4", "label": "if", "type": "if", "loc": [57, 60], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L56_C2", "vector": [4, 2, 0.5969, 0.0408, 2, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if word in wordsMap:\n wordsMap[word] +=1\n else:\n wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L60_C6", "label": "assign", "type": "assigned_variable", "loc": [60, 60], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L57_C4", "vector": [14, 3, 0.6122, 0.0102, 3, 0.84, 0.0, 0, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " wordsMap[word] = 1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Return_L62_C2", "label": "return", "type": "return", "loc": [62, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "vector": [13, 1, 0.6327, 0.0102, 1, 0.18, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return wordsMap"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "label": "print_words", "type": "function", "loc": [66, 71], "level": 0, "parent": null, "vector": [2, 0, 0.699, 0.0612, 0, 0.66, 0.5714, 267, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n wordsMap = read_file(filename)\n keys=sorted(wordsMap.keys())\n for key in keys:\n print(key, wordsMap[key])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L67_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "vector": [14, 1, 0.6837, 0.0102, 1, 0.43, 0.0, 879, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " wordsMap = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L68_C2", "label": "keys = sorted()", "type": "assigned_variable", "loc": [68, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "vector": [14, 1, 0.6939, 0.0102, 1, 0.43, 0.3333, 204, 3, 1, 0, 0, 134, 10, 2], "semantic": {"name": "keys", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " keys=sorted(wordsMap.keys())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L69_C2", "label": "for key", "type": "for", "loc": [69, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "vector": [6, 1, 0.7092, 0.0204, 1, 0.43, 0.6667, 230, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "key", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for key in keys:\n print(key, wordsMap[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L70_C4", "label": "print()", "type": "expression", "loc": [70, 70], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L69_C2", "vector": [8, 2, 0.7143, 0.0102, 2, 0.64, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(key, wordsMap[key])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Return_L71_C2", "label": "return", "type": "return", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "vector": [13, 1, 0.7245, 0.0102, 1, 0.43, 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_1213:FunctionDef_L73_C0", "label": "print_top", "type": "function", "loc": [73, 76], "level": 0, "parent": null, "vector": [2, 0, 0.7602, 0.0408, 0, 0.66, 0.7143, 148, 0, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n wordsMap = read_file(filename)\n for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L74_C2", "label": "wordsMap = read_file()", "type": "assigned_variable", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L73_C0", "vector": [14, 1, 0.7551, 0.0102, 1, 0.28, 0.0, 879, 3, 1, 0, 0, 542, 10, 1], "semantic": {"name": "wordsMap", "arg_names": [], "import_names": [], "rhs_call_name": "read_file", "annotation": ""}, "snippet": " wordsMap = read_file(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L75_C2", "label": "for item", "type": "for", "loc": [75, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L73_C0", "vector": [6, 1, 0.7704, 0.0204, 1, 0.28, 1.0, 434, 6, 0, 0, 0, 0, 0, 1], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in items[:20]:\n print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L76_C4", "label": "print()", "type": "expression", "loc": [76, 76], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L75_C2", "vector": [8, 2, 0.7755, 0.0102, 2, 0.42, 0.0, 535, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(item[0], item[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "label": "main", "type": "function", "loc": [82, 95], "level": 0, "parent": null, "vector": [2, 0, 0.9031, 0.1429, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2", "label": "if", "type": "if", "loc": [83, 85], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "vector": [4, 1, 0.8571, 0.0306, 1, 0.78, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L84_C4", "label": "print()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2", "vector": [8, 2, 0.8571, 0.0102, 2, 0.89, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L85_C4", "label": "exit()", "type": "expression", "loc": [85, 85], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2", "vector": [8, 2, 0.8673, 0.0102, 2, 0.89, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L87_C2", "label": "option =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "vector": [14, 1, 0.8878, 0.0102, 1, 0.78, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L88_C2", "label": "filename =", "type": "assigned_variable", "loc": [88, 88], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "vector": [14, 1, 0.898, 0.0102, 1, 0.78, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2", "label": "if", "type": "if", "loc": [89, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "vector": [4, 1, 0.9388, 0.0714, 1, 0.78, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L90_C4", "label": "print_words()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.57, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "label": "if", "type": "if", "loc": [91, 95], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2", "vector": [4, 2, 0.949, 0.051, 2, 0.57, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L92_C4", "label": "print_top()", "type": "expression", "loc": [92, 92], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "vector": [8, 3, 0.9388, 0.0102, 3, 0.32, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L94_C4", "label": "print()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "vector": [8, 3, 0.9592, 0.0102, 3, 0.32, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L95_C4", "label": "exit()", "type": "expression", "loc": [95, 95], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "vector": [8, 3, 0.9694, 0.0102, 3, 0.32, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L97_C0", "label": "if", "type": "if", "loc": [97, 98], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0204, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.2, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L56_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L57_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L60_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Return_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L69_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Return_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L83_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L85_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Assign_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:FunctionDef_L82_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L95_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1213:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1213:Expr_L98_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
import re
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
f=open(filename,'r')
text=f.read()
text=re.sub("[(/.,!?:-;)`]","",text)
str1=text.lower().split()
mimic={"":str1[0]}
suf=[]
for i in range(len(str1)):
if mimic.get(str1[i])==None:
j=i
for j in range(len(str1)-1):
if str1[i]==str1[j]:
suf.append((str1[j+1]))
mimic.update({str1[i]:suf})
suf=[]
return mimic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
for i in range(200):
if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:
word=mimic_dict.get('')
sys.stdout.write("%s " %(word))
else:
word=random.choice(mimic_dict.get(word))
sys.stdout.write("%s " %(word))
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1216 | 38 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2602, 0.3469, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Mimic pyquick exercise -- optional extra exercise.\nGoogle's Python Class\n\nRead in the file specified on the command line.\nDo a simple split() on whitespace to obtain all the words in the file.\nRather than read the file line by line, it's easier to read\nit into one giant string and split it once.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.449, 0.0102, 0, 0.66, 0.1429, 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_1216:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4592, 0.0102, 0, 0.66, 0.2857, 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_1216:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4694, 0.0102, 0, 0.66, 0.4286, 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_1216:FunctionDef_L50_C0", "label": "mimic_dict", "type": "function", "loc": [50, 69], "level": 0, "parent": null, "vector": [2, 0, 0.6071, 0.2041, 0, 0.66, 0.5714, 49, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "mimic_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mimic_dict(filename):\n \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\"\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[(/.,!?:-;)`]\",\"\",text)\n str1=text.lower().split()\n \n mimic={\"\":str1[0]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [8, 1, 0.5204, 0.0102, 1, 0.2, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L52_C2", "label": "f = open()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.2, 0.125, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L53_C2", "label": "text = read()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.2, 0.25, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text=f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L54_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.2, 0.375, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text=re.sub(\"[(/.,!?:-;)`]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L55_C2", "label": "str1 = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.2, 0.5, 39, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " str1=text.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L57_C2", "label": "mimic =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.5816, 0.0102, 1, 0.2, 0.625, 615, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "mimic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimic={\"\":str1[0]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L58_C2", "label": "suf =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [14, 1, 0.5918, 0.0102, 1, 0.2, 0.75, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L60_C2", "label": "for i", "type": "for", "loc": [60, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [6, 1, 0.6531, 0.0918, 1, 0.2, 0.875, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(str1)):\n if mimic.get(str1[i])==None:\n j=i\n for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))\n \n mimic.update({str1[i]:suf})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "label": "if", "type": "if", "loc": [61, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L60_C2", "vector": [4, 2, 0.6582, 0.0816, 2, 0.84, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic.get(str1[i])==None:\n j=i\n for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))\n \n mimic.update({str1[i]:suf})\n suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L62_C6", "label": "j =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "vector": [14, 3, 0.6327, 0.0102, 3, 0.85, 0.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j=i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L63_C6", "label": "for j", "type": "for", "loc": [63, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "vector": [6, 3, 0.6531, 0.0306, 3, 0.85, 0.3333, 100, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L63_C6", "vector": [4, 4, 0.6582, 0.0204, 4, 0.43, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str1[i]==str1[j]:\n suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L65_C10", "label": "append()", "type": "expression", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L64_C8", "vector": [8, 5, 0.6633, 0.0102, 5, 0.64, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L67_C6", "label": "update()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "vector": [8, 3, 0.6837, 0.0102, 3, 0.85, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " mimic.update({str1[i]:suf})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L68_C6", "label": "suf =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "vector": [14, 3, 0.6939, 0.0102, 3, 0.85, 1.0, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Return_L69_C2", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "vector": [13, 1, 0.7041, 0.0102, 1, 0.2, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mimic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "label": "print_mimic", "type": "function", "loc": [73, 84], "level": 0, "parent": null, "vector": [2, 0, 0.801, 0.1224, 0, 0.66, 0.7143, 927, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "print_mimic", "arg_names": ["mimic_dict", "word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_mimic(mimic_dict, word):\n \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\"\n # +++your code here+++\n for i in range(200):\n if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L74_C2", "label": "expression", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "vector": [8, 1, 0.7551, 0.0102, 1, 0.91, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L76_C2", "label": "for i", "type": "for", "loc": [76, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "vector": [6, 1, 0.8112, 0.0816, 1, 0.91, 0.5, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(200):\n if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n \n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "label": "if", "type": "if", "loc": [77, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L76_C2", "vector": [4, 2, 0.8163, 0.0714, 2, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n \n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L78_C6", "label": "word = get()", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "vector": [14, 3, 0.7959, 0.0102, 3, 0.88, 0.0, 107, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " word=mimic_dict.get('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L79_C6", "label": "write()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "vector": [8, 3, 0.8061, 0.0102, 3, 0.88, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L82_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "vector": [14, 3, 0.8367, 0.0102, 3, 0.88, 0.6667, 107, 3, 1, 0, 0, 30, 10, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " word=random.choice(mimic_dict.get(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L83_C6", "label": "write()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "vector": [8, 3, 0.8469, 0.0102, 3, 0.88, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Return_L84_C2", "label": "return", "type": "return", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "vector": [13, 1, 0.8571, 0.0102, 1, 0.91, 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_1216:FunctionDef_L88_C0", "label": "main", "type": "function", "loc": [88, 94], "level": 0, "parent": null, "vector": [2, 0, 0.9286, 0.0714, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)\n\n dict = mimic_dict(sys.argv[1])\n print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2", "label": "if", "type": "if", "loc": [89, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "vector": [4, 1, 0.9184, 0.0306, 1, 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(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.42, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L91_C4", "label": "exit()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2", "vector": [8, 2, 0.9286, 0.0102, 2, 0.42, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L93_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "vector": [14, 1, 0.949, 0.0102, 1, 0.2, 0.5, 827, 3, 1, 0, 0, 49, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "mimic_dict", "annotation": ""}, "snippet": " dict = mimic_dict(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L94_C2", "label": "print_mimic()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "vector": [8, 1, 0.9592, 0.0102, 1, 0.2, 1.0, 927, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print_mimic", "arg_names": [], "import_names": [], "rhs_call_name": "print_mimic", "annotation": ""}, "snippet": " print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L97_C0", "label": "if", "type": "if", "loc": [97, 98], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0204, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.09, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L63_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L65_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L68_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Return_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:For_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Return_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Assign_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1216:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1216:Expr_L98_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
# +++your code here+++
for x in nums:
if(nums.count(x) > 1):
nums.remove(x)
return nums
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
# +++your code here+++
return sorted(list1+list2)
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1220 | 22 | 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_1220:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 21], "level": 0, "parent": null, "vector": [2, 0, 0.2535, 0.0986, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n \n for x in nums:\n if(nums.count(x) > 1):\n nums.remove(x)\n return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:For_L18_C2", "label": "for x", "type": "for", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L15_C0", "vector": [6, 1, 0.2676, 0.0423, 1, 0.44, 0.0, 190, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in nums:\n if(nums.count(x) > 1):\n nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:For_L18_C2", "vector": [4, 2, 0.2746, 0.0282, 2, 0.82, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if(nums.count(x) > 1):\n nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L20_C6", "label": "remove()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L19_C4", "vector": [8, 3, 0.2817, 0.0141, 3, 0.27, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L15_C0", "vector": [13, 1, 0.2958, 0.0141, 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 nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L31_C0", "label": "linear_merge", "type": "function", "loc": [31, 34], "level": 0, "parent": null, "vector": [2, 0, 0.4577, 0.0563, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n # +++your code here+++\n \n return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Return_L34_C2", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L31_C0", "vector": [13, 1, 0.4789, 0.0141, 1, 0.51, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L47_C0", "label": "test", "type": "function", "loc": [47, 52], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0845, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2", "label": "if", "type": "if", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L47_C0", "vector": [4, 1, 0.6972, 0.0563, 1, 0.4, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Assign_L49_C4", "label": "prefix =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2", "vector": [14, 2, 0.6901, 0.0141, 2, 0.08, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Assign_L51_C4", "label": "prefix =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2", "vector": [14, 2, 0.7183, 0.0141, 2, 0.08, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L52_C2", "label": "print()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L47_C0", "vector": [8, 1, 0.7324, 0.0141, 1, 0.4, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "label": "main", "type": "function", "loc": [56, 67], "level": 0, "parent": null, "vector": [2, 0, 0.8662, 0.169, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L57_C2", "label": "print()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.8028, 0.0141, 1, 0.24, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.8169, 0.0141, 1, 0.24, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.831, 0.0141, 1, 0.24, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.8451, 0.0141, 1, 0.24, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.8803, 0.0282, 1, 0.24, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L64_C2", "label": "test()", "type": "expression", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.9085, 0.0282, 1, 0.24, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L66_C2", "label": "test()", "type": "expression", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "vector": [8, 1, 0.9366, 0.0282, 1, 0.24, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L70_C0", "label": "if", "type": "if", "loc": [70, 71], "level": 0, "parent": null, "vector": [4, 0, 0.993, 0.0282, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 1, 0.42, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:For_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:For_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Return_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1220:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1220:Expr_L71_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
import re
# +++your code here+++
def print_words(filename):
fo = open(filename, "r+")
str1 = fo.read()
str1=re.sub("[(/.,!?:-;)`]", "",str1)
c={};
keyGen(str1,c)
fo.close()
printing(c)
def keyGen(str1,c):
i=0;
k=0
temp=str1.lower().split()
for x in temp:
c.update({temp[i]:temp.count(x)})
i+=1
def printing(c):
for k in c:
print k,'\t',c[k]
def print_top(filename):
fo = open(filename, "r+")
str1 = fo.read()
str1=re.sub("[/.,!?;]", "",str1)
c={};
keyGen(str1,c)
b = list(c.items())
b.sort(key=lambda item: item[1],reverse=True)
for item in b[:20]:
print(item[0] +' - '+ str(item[1]))
fo.close()
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1221 | 45 | 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_1221:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2217, 0.283, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.3774, 0.0094, 0, 0.66, 0.125, 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_1221:Import_L41_C0", "label": "re import re", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.3868, 0.0094, 0, 0.66, 0.25, 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_1221:FunctionDef_L45_C0", "label": "print_words", "type": "function", "loc": [45, 52], "level": 0, "parent": null, "vector": [2, 0, 0.4575, 0.0755, 0, 0.66, 0.375, 267, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n fo = open(filename, \"r+\")\n str1 = fo.read()\n str1=re.sub(\"[(/.,!?:-;)`]\", \"\",str1)\n c={};\n keyGen(str1,c)\n fo.close()\n printing(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L46_C4", "label": "fo = open()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [14, 1, 0.434, 0.0094, 1, 0.01, 0.0, 542, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fo", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fo = open(filename, \"r+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L47_C4", "label": "str1 = read()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [14, 1, 0.4434, 0.0094, 1, 0.01, 0.1667, 39, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str1 = fo.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L48_C4", "label": "str1 = sub()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [14, 1, 0.4528, 0.0094, 1, 0.01, 0.3333, 39, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str1=re.sub(\"[(/.,!?:-;)`]\", \"\",str1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L49_C4", "label": "c =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [14, 1, 0.4623, 0.0094, 1, 0.01, 0.5, 411, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c={};"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L50_C4", "label": "keyGen()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [8, 1, 0.4717, 0.0094, 1, 0.01, 0.6667, 811, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "keyGen", "arg_names": [], "import_names": [], "rhs_call_name": "keyGen", "annotation": ""}, "snippet": " keyGen(str1,c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L51_C4", "label": "close()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [8, 1, 0.4811, 0.0094, 1, 0.01, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fo.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L52_C4", "label": "printing()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "vector": [8, 1, 0.4906, 0.0094, 1, 0.01, 1.0, 193, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printing", "arg_names": [], "import_names": [], "rhs_call_name": "printing", "annotation": ""}, "snippet": " printing(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "label": "keyGen", "type": "function", "loc": [54, 60], "level": 0, "parent": null, "vector": [2, 0, 0.5377, 0.066, 0, 0.66, 0.5, 811, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "keyGen", "arg_names": ["str1", "c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def keyGen(str1,c):\n i=0;\n k=0\n temp=str1.lower().split()\n for x in temp:\n c.update({temp[i]:temp.count(x)})\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L55_C4", "label": "i =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "vector": [14, 1, 0.5189, 0.0094, 1, 0.66, 0.0, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L56_C4", "label": "k =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "vector": [14, 1, 0.5283, 0.0094, 1, 0.66, 0.3333, 954, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L57_C4", "label": "temp = split()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "vector": [14, 1, 0.5377, 0.0094, 1, 0.66, 0.6667, 915, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " temp=str1.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L58_C4", "label": "for x", "type": "for", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "vector": [6, 1, 0.5566, 0.0283, 1, 0.66, 1.0, 190, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in temp:\n c.update({temp[i]:temp.count(x)})\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L59_C8", "label": "update()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L58_C4", "vector": [8, 2, 0.5566, 0.0094, 2, 0.69, 0.0, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " c.update({temp[i]:temp.count(x)})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L64_C0", "label": "printing", "type": "function", "loc": [64, 66], "level": 0, "parent": null, "vector": [2, 0, 0.6132, 0.0283, 0, 0.66, 0.625, 193, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printing", "arg_names": ["c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printing(c):\n for k in c: \n print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L65_C4", "label": "for k", "type": "for", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L64_C0", "vector": [6, 1, 0.6179, 0.0189, 1, 0.94, 0.0, 954, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in c: \n print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L66_C8", "label": "print()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L65_C4", "vector": [8, 2, 0.6226, 0.0094, 2, 0.68, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "label": "print_top", "type": "function", "loc": [69, 79], "level": 0, "parent": null, "vector": [2, 0, 0.6981, 0.1038, 0, 0.66, 0.75, 148, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n fo = open(filename, \"r+\")\n str1 = fo.read()\n str1=re.sub(\"[/.,!?;]\", \"\",str1)\n c={};\n keyGen(str1,c)\n b = list(c.items())\n b.sort(key=lambda item: item[1],reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L70_C4", "label": "fo = open()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [14, 1, 0.6604, 0.0094, 1, 0.04, 0.0, 542, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fo", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fo = open(filename, \"r+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L71_C4", "label": "str1 = read()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [14, 1, 0.6698, 0.0094, 1, 0.04, 0.125, 39, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str1 = fo.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L72_C4", "label": "str1 = sub()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [14, 1, 0.6792, 0.0094, 1, 0.04, 0.25, 39, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str1=re.sub(\"[/.,!?;]\", \"\",str1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L73_C4", "label": "c =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [14, 1, 0.6887, 0.0094, 1, 0.04, 0.375, 411, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c={};"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L74_C4", "label": "keyGen()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [8, 1, 0.6981, 0.0094, 1, 0.04, 0.5, 811, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "keyGen", "arg_names": [], "import_names": [], "rhs_call_name": "keyGen", "annotation": ""}, "snippet": " keyGen(str1,c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L75_C4", "label": "b = list()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [14, 1, 0.7075, 0.0094, 1, 0.04, 0.625, 756, 3, 1, 0, 0, 430, 10, 2], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " b = list(c.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L76_C4", "label": "sort()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [8, 1, 0.717, 0.0094, 1, 0.04, 0.75, 489, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " b.sort(key=lambda item: item[1],reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L77_C4", "label": "for item", "type": "for", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [6, 1, 0.7311, 0.0189, 1, 0.04, 0.875, 434, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in b[:20]:\n print(item[0] +' - '+ str(item[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L78_C8", "label": "print()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L77_C4", "vector": [8, 2, 0.7358, 0.0094, 2, 0.04, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(item[0] +' - '+ str(item[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L79_C4", "label": "close()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "vector": [8, 1, 0.7453, 0.0094, 1, 0.04, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fo.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "label": "main", "type": "function", "loc": [90, 103], "level": 0, "parent": null, "vector": [2, 0, 0.9104, 0.1321, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2", "label": "if", "type": "if", "loc": [91, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "vector": [4, 1, 0.8679, 0.0283, 1, 0.3, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L92_C4", "label": "print()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2", "vector": [8, 2, 0.8679, 0.0094, 2, 0.31, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L93_C4", "label": "exit()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2", "vector": [8, 2, 0.8774, 0.0094, 2, 0.31, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L95_C2", "label": "option =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "vector": [14, 1, 0.8962, 0.0094, 1, 0.3, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L96_C2", "label": "filename =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "vector": [14, 1, 0.9057, 0.0094, 1, 0.3, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2", "label": "if", "type": "if", "loc": [97, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "vector": [4, 1, 0.9434, 0.066, 1, 0.3, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L98_C4", "label": "print_words()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2", "vector": [8, 2, 0.9245, 0.0094, 2, 0.66, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "label": "if", "type": "if", "loc": [99, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2", "vector": [4, 2, 0.9528, 0.0472, 2, 0.66, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L100_C4", "label": "print_top()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "vector": [8, 3, 0.9434, 0.0094, 3, 0.07, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L102_C4", "label": "print()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "vector": [8, 3, 0.9623, 0.0094, 3, 0.07, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L103_C4", "label": "exit()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "vector": [8, 3, 0.9717, 0.0094, 3, 0.07, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L105_C0", "label": "if", "type": "if", "loc": [105, 106], "level": 0, "parent": null, "vector": [4, 0, 0.9953, 0.0189, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L106_C2", "label": "main()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L105_C0", "vector": [8, 1, 1.0, 0.0094, 1, 0.66, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:For_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1221:If_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1221:Expr_L106_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
import re
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
f=open(filename,'r')
text=f.read()
text=re.sub("[(/.,!?:-;)`]","",text)
str1=text.lower().split()
mimic={"":str1[0]}
suf=[]
for i in range(len(str1)):
if mimic.get(str1[i])==None:
j=i
for j in range(len(str1)-1):
if str1[i]==str1[j]:
suf.append((str1[j+1]))
mimic.update({str1[i]:suf})
suf=[]
return mimic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
# +++your code here+++
for i in range(200):
if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:
word=mimic_dict.get('')
sys.stdout.write("%s " %(word))
else:
word=random.choice(mimic_dict.get(word))
sys.stdout.write("%s " %(word))
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1222 | 38 | 98 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2602, 0.3469, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Mimic pyquick exercise -- optional extra exercise.\nGoogle's Python Class\n\nRead in the file specified on the command line.\nDo a simple split() on whitespace to obtain all the words in the file.\nRather than read the file line by line, it's easier to read\nit into one giant string and split it once.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.449, 0.0102, 0, 0.66, 0.1429, 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_1222:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4592, 0.0102, 0, 0.66, 0.2857, 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_1222:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4694, 0.0102, 0, 0.66, 0.4286, 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_1222:FunctionDef_L50_C0", "label": "mimic_dict", "type": "function", "loc": [50, 69], "level": 0, "parent": null, "vector": [2, 0, 0.6071, 0.2041, 0, 0.66, 0.5714, 49, 0, 1, 1, 0, 0, 0, 12], "semantic": {"name": "mimic_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mimic_dict(filename):\n \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\"\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[(/.,!?:-;)`]\",\"\",text)\n str1=text.lower().split()\n \n mimic={\"\":str1[0]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L51_C2", "label": "expression", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [8, 1, 0.5204, 0.0102, 1, 0.76, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L52_C2", "label": "f = open()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.5306, 0.0102, 1, 0.76, 0.125, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L53_C2", "label": "text = read()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.5408, 0.0102, 1, 0.76, 0.25, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text=f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L54_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.551, 0.0102, 1, 0.76, 0.375, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text=re.sub(\"[(/.,!?:-;)`]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L55_C2", "label": "str1 = split()", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.5612, 0.0102, 1, 0.76, 0.5, 39, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " str1=text.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L57_C2", "label": "mimic =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.5816, 0.0102, 1, 0.76, 0.625, 615, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "mimic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimic={\"\":str1[0]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L58_C2", "label": "suf =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [14, 1, 0.5918, 0.0102, 1, 0.76, 0.75, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L60_C2", "label": "for i", "type": "for", "loc": [60, 68], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [6, 1, 0.6531, 0.0918, 1, 0.76, 0.875, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(str1)):\n if mimic.get(str1[i])==None:\n j=i\n for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))\n \n mimic.update({str1[i]:suf})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "label": "if", "type": "if", "loc": [61, 68], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L60_C2", "vector": [4, 2, 0.6582, 0.0816, 2, 0.22, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic.get(str1[i])==None:\n j=i\n for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))\n \n mimic.update({str1[i]:suf})\n suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L62_C6", "label": "j =", "type": "assigned_variable", "loc": [62, 62], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "vector": [14, 3, 0.6327, 0.0102, 3, 0.21, 0.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j=i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L63_C6", "label": "for j", "type": "for", "loc": [63, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "vector": [6, 3, 0.6531, 0.0306, 3, 0.21, 0.3333, 100, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range(len(str1)-1):\n if str1[i]==str1[j]:\n suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L64_C8", "label": "if", "type": "if", "loc": [64, 65], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L63_C6", "vector": [4, 4, 0.6582, 0.0204, 4, 0.91, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if str1[i]==str1[j]:\n suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L65_C10", "label": "append()", "type": "expression", "loc": [65, 65], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L64_C8", "vector": [8, 5, 0.6633, 0.0102, 5, 0.72, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " suf.append((str1[j+1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L67_C6", "label": "update()", "type": "expression", "loc": [67, 67], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "vector": [8, 3, 0.6837, 0.0102, 3, 0.21, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " mimic.update({str1[i]:suf})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L68_C6", "label": "suf =", "type": "assigned_variable", "loc": [68, 68], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "vector": [14, 3, 0.6939, 0.0102, 3, 0.21, 1.0, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Return_L69_C2", "label": "return", "type": "return", "loc": [69, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "vector": [13, 1, 0.7041, 0.0102, 1, 0.76, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return mimic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "label": "print_mimic", "type": "function", "loc": [73, 84], "level": 0, "parent": null, "vector": [2, 0, 0.801, 0.1224, 0, 0.66, 0.7143, 927, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "print_mimic", "arg_names": ["mimic_dict", "word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_mimic(mimic_dict, word):\n \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\"\n # +++your code here+++\n for i in range(200):\n if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L74_C2", "label": "expression", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "vector": [8, 1, 0.7551, 0.0102, 1, 0.93, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L76_C2", "label": "for i", "type": "for", "loc": [76, 83], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "vector": [6, 1, 0.8112, 0.0816, 1, 0.93, 0.5, 826, 3, 0, 0, 0, 0, 0, 8], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(200):\n if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n \n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "label": "if", "type": "if", "loc": [77, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L76_C2", "vector": [4, 2, 0.8163, 0.0714, 2, 0.93, 0.0, 0, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if word=='' or mimic_dict.get(word)==[]or mimic_dict.get(word)==None:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n \n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L78_C6", "label": "word = get()", "type": "assigned_variable", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "vector": [14, 3, 0.7959, 0.0102, 3, 0.58, 0.0, 107, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " word=mimic_dict.get('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L79_C6", "label": "write()", "type": "expression", "loc": [79, 79], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "vector": [8, 3, 0.8061, 0.0102, 3, 0.58, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L82_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [82, 82], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "vector": [14, 3, 0.8367, 0.0102, 3, 0.58, 0.6667, 107, 3, 1, 0, 0, 30, 10, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " word=random.choice(mimic_dict.get(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L83_C6", "label": "write()", "type": "expression", "loc": [83, 83], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "vector": [8, 3, 0.8469, 0.0102, 3, 0.58, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word)) "}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Return_L84_C2", "label": "return", "type": "return", "loc": [84, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "vector": [13, 1, 0.8571, 0.0102, 1, 0.93, 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_1222:FunctionDef_L88_C0", "label": "main", "type": "function", "loc": [88, 94], "level": 0, "parent": null, "vector": [2, 0, 0.9286, 0.0714, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)\n\n dict = mimic_dict(sys.argv[1])\n print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2", "label": "if", "type": "if", "loc": [89, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "vector": [4, 1, 0.9184, 0.0306, 1, 0.5, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L90_C4", "label": "print()", "type": "expression", "loc": [90, 90], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2", "vector": [8, 2, 0.9184, 0.0102, 2, 0.17, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L91_C4", "label": "exit()", "type": "expression", "loc": [91, 91], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2", "vector": [8, 2, 0.9286, 0.0102, 2, 0.17, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L93_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [93, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "vector": [14, 1, 0.949, 0.0102, 1, 0.5, 0.5, 827, 3, 1, 0, 0, 49, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "mimic_dict", "annotation": ""}, "snippet": " dict = mimic_dict(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L94_C2", "label": "print_mimic()", "type": "expression", "loc": [94, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "vector": [8, 1, 0.9592, 0.0102, 1, 0.5, 1.0, 927, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print_mimic", "arg_names": [], "import_names": [], "rhs_call_name": "print_mimic", "annotation": ""}, "snippet": " print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L97_C0", "label": "if", "type": "if", "loc": [97, 98], "level": 0, "parent": null, "vector": [4, 0, 0.9949, 0.0204, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L98_C2", "label": "main()", "type": "expression", "loc": [98, 98], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L97_C0", "vector": [8, 1, 1.0, 0.0102, 1, 0.09, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L60_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L63_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L63_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L64_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L64_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L65_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L67_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L61_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L68_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L50_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Return_L69_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L74_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L76_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:For_L76_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L79_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L82_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L83_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L73_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Return_L84_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L90_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L89_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Assign_L93_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:FunctionDef_L88_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L94_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1222:If_L97_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1222:Expr_L98_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
# +++your code here+++
for x in nums:
if(nums.count(x) > 1):
nums.remove(x)
return nums
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
# +++your code here+++
return sorted(list1+list2)
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1224 | 22 | 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_1224:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 21], "level": 0, "parent": null, "vector": [2, 0, 0.2535, 0.0986, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 2], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n # +++your code here+++\n \n for x in nums:\n if(nums.count(x) > 1):\n nums.remove(x)\n return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:For_L18_C2", "label": "for x", "type": "for", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L15_C0", "vector": [6, 1, 0.2676, 0.0423, 1, 0.85, 0.0, 190, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in nums:\n if(nums.count(x) > 1):\n nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:For_L18_C2", "vector": [4, 2, 0.2746, 0.0282, 2, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 2], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if(nums.count(x) > 1):\n nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L20_C6", "label": "remove()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L19_C4", "vector": [8, 3, 0.2817, 0.0141, 3, 0.69, 0.0, 185, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "remove", "arg_names": [], "import_names": [], "rhs_call_name": "remove", "annotation": ""}, "snippet": " nums.remove(x)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L15_C0", "vector": [13, 1, 0.2958, 0.0141, 1, 0.85, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return nums"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L31_C0", "label": "linear_merge", "type": "function", "loc": [31, 34], "level": 0, "parent": null, "vector": [2, 0, 0.4577, 0.0563, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 1], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n # +++your code here+++\n \n return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Return_L34_C2", "label": "return", "type": "return", "loc": [34, 34], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L31_C0", "vector": [13, 1, 0.4789, 0.0141, 1, 0.57, 0.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(list1+list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L47_C0", "label": "test", "type": "function", "loc": [47, 52], "level": 0, "parent": null, "vector": [2, 0, 0.6972, 0.0845, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2", "label": "if", "type": "if", "loc": [48, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L47_C0", "vector": [4, 1, 0.6972, 0.0563, 1, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Assign_L49_C4", "label": "prefix =", "type": "assigned_variable", "loc": [49, 49], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2", "vector": [14, 2, 0.6901, 0.0141, 2, 0.36, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Assign_L51_C4", "label": "prefix =", "type": "assigned_variable", "loc": [51, 51], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2", "vector": [14, 2, 0.7183, 0.0141, 2, 0.36, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L52_C2", "label": "print()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L47_C0", "vector": [8, 1, 0.7324, 0.0141, 1, 0.65, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "label": "main", "type": "function", "loc": [56, 67], "level": 0, "parent": null, "vector": [2, 0, 0.8662, 0.169, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L57_C2", "label": "print()", "type": "expression", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.8028, 0.0141, 1, 0.17, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.8169, 0.0141, 1, 0.17, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L59_C2", "label": "test()", "type": "expression", "loc": [59, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.831, 0.0141, 1, 0.17, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.8451, 0.0141, 1, 0.17, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.8803, 0.0282, 1, 0.17, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L64_C2", "label": "test()", "type": "expression", "loc": [64, 65], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.9085, 0.0282, 1, 0.17, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L66_C2", "label": "test()", "type": "expression", "loc": [66, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "vector": [8, 1, 0.9366, 0.0282, 1, 0.17, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L70_C0", "label": "if", "type": "if", "loc": [70, 71], "level": 0, "parent": null, "vector": [4, 0, 0.993, 0.0282, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L71_C2", "label": "main()", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L70_C0", "vector": [8, 1, 1.0, 0.0141, 1, 0.74, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:For_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:For_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L31_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Return_L34_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L48_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Assign_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L47_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L64_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:FunctionDef_L56_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1224:If_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1224:Expr_L71_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
import re
# +++your code here+++
def print_words(filename):
fo = open(filename, "r+")
str1 = fo.read()
str1=re.sub("[(/.,!?:-;)`]", "",str1)
c={};
keyGen(str1,c)
fo.close()
printing(c)
def keyGen(str1,c):
i=0;
k=0
temp=str1.lower().split()
for x in temp:
c.update({temp[i]:temp.count(x)})
i+=1
def printing(c):
for k in c:
print k,'\t',c[k]
def print_top(filename):
fo = open(filename, "r+")
str1 = fo.read()
str1=re.sub("[/.,!?;]", "",str1)
c={};
keyGen(str1,c)
b = list(c.items())
b.sort(key=lambda item: item[1],reverse=True)
for item in b[:20]:
print(item[0] +' - '+ str(item[1]))
fo.close()
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1225 | 45 | 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_1225:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2217, 0.283, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.3774, 0.0094, 0, 0.66, 0.125, 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_1225:Import_L41_C0", "label": "re import re", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.3868, 0.0094, 0, 0.66, 0.25, 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_1225:FunctionDef_L45_C0", "label": "print_words", "type": "function", "loc": [45, 52], "level": 0, "parent": null, "vector": [2, 0, 0.4575, 0.0755, 0, 0.66, 0.375, 267, 0, 1, 0, 0, 0, 0, 6], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n fo = open(filename, \"r+\")\n str1 = fo.read()\n str1=re.sub(\"[(/.,!?:-;)`]\", \"\",str1)\n c={};\n keyGen(str1,c)\n fo.close()\n printing(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L46_C4", "label": "fo = open()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [14, 1, 0.434, 0.0094, 1, 0.51, 0.0, 542, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fo", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fo = open(filename, \"r+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L47_C4", "label": "str1 = read()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [14, 1, 0.4434, 0.0094, 1, 0.51, 0.1667, 39, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str1 = fo.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L48_C4", "label": "str1 = sub()", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [14, 1, 0.4528, 0.0094, 1, 0.51, 0.3333, 39, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str1=re.sub(\"[(/.,!?:-;)`]\", \"\",str1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L49_C4", "label": "c =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [14, 1, 0.4623, 0.0094, 1, 0.51, 0.5, 411, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c={};"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L50_C4", "label": "keyGen()", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [8, 1, 0.4717, 0.0094, 1, 0.51, 0.6667, 811, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "keyGen", "arg_names": [], "import_names": [], "rhs_call_name": "keyGen", "annotation": ""}, "snippet": " keyGen(str1,c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L51_C4", "label": "close()", "type": "expression", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [8, 1, 0.4811, 0.0094, 1, 0.51, 0.8333, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fo.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L52_C4", "label": "printing()", "type": "expression", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "vector": [8, 1, 0.4906, 0.0094, 1, 0.51, 1.0, 193, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printing", "arg_names": [], "import_names": [], "rhs_call_name": "printing", "annotation": ""}, "snippet": " printing(c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "label": "keyGen", "type": "function", "loc": [54, 60], "level": 0, "parent": null, "vector": [2, 0, 0.5377, 0.066, 0, 0.66, 0.5, 811, 0, 2, 0, 0, 0, 0, 4], "semantic": {"name": "keyGen", "arg_names": ["str1", "c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def keyGen(str1,c):\n i=0;\n k=0\n temp=str1.lower().split()\n for x in temp:\n c.update({temp[i]:temp.count(x)})\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L55_C4", "label": "i =", "type": "assigned_variable", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "vector": [14, 1, 0.5189, 0.0094, 1, 0.43, 0.0, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=0;"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L56_C4", "label": "k =", "type": "assigned_variable", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "vector": [14, 1, 0.5283, 0.0094, 1, 0.43, 0.3333, 954, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " k=0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L57_C4", "label": "temp = split()", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "vector": [14, 1, 0.5377, 0.0094, 1, 0.43, 0.6667, 915, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "temp", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " temp=str1.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L58_C4", "label": "for x", "type": "for", "loc": [58, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "vector": [6, 1, 0.5566, 0.0283, 1, 0.43, 1.0, 190, 2, 0, 0, 0, 0, 0, 2], "semantic": {"name": "x", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for x in temp:\n c.update({temp[i]:temp.count(x)})\n i+=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L59_C8", "label": "update()", "type": "expression", "loc": [59, 59], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L58_C4", "vector": [8, 2, 0.5566, 0.0094, 2, 0.03, 0.0, 637, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " c.update({temp[i]:temp.count(x)})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L64_C0", "label": "printing", "type": "function", "loc": [64, 66], "level": 0, "parent": null, "vector": [2, 0, 0.6132, 0.0283, 0, 0.66, 0.625, 193, 0, 1, 0, 0, 0, 0, 1], "semantic": {"name": "printing", "arg_names": ["c"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def printing(c):\n for k in c: \n print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L65_C4", "label": "for k", "type": "for", "loc": [65, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L64_C0", "vector": [6, 1, 0.6179, 0.0189, 1, 0.77, 0.0, 954, 2, 0, 0, 0, 0, 0, 1], "semantic": {"name": "k", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for k in c: \n print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L66_C8", "label": "print()", "type": "expression", "loc": [66, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L65_C4", "vector": [8, 2, 0.6226, 0.0094, 2, 0.46, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(k,'\\t',c[k])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "label": "print_top", "type": "function", "loc": [69, 79], "level": 0, "parent": null, "vector": [2, 0, 0.6981, 0.1038, 0, 0.66, 0.75, 148, 0, 1, 0, 0, 0, 0, 10], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n fo = open(filename, \"r+\")\n str1 = fo.read()\n str1=re.sub(\"[/.,!?;]\", \"\",str1)\n c={};\n keyGen(str1,c)\n b = list(c.items())\n b.sort(key=lambda item: item[1],reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L70_C4", "label": "fo = open()", "type": "assigned_variable", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [14, 1, 0.6604, 0.0094, 1, 0.61, 0.0, 542, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "fo", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " fo = open(filename, \"r+\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L71_C4", "label": "str1 = read()", "type": "assigned_variable", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [14, 1, 0.6698, 0.0094, 1, 0.61, 0.125, 39, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " str1 = fo.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L72_C4", "label": "str1 = sub()", "type": "assigned_variable", "loc": [72, 72], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [14, 1, 0.6792, 0.0094, 1, 0.61, 0.25, 39, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "str1", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " str1=re.sub(\"[/.,!?;]\", \"\",str1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L73_C4", "label": "c =", "type": "assigned_variable", "loc": [73, 73], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [14, 1, 0.6887, 0.0094, 1, 0.61, 0.375, 411, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "c", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " c={};"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L74_C4", "label": "keyGen()", "type": "expression", "loc": [74, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [8, 1, 0.6981, 0.0094, 1, 0.61, 0.5, 811, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "keyGen", "arg_names": [], "import_names": [], "rhs_call_name": "keyGen", "annotation": ""}, "snippet": " keyGen(str1,c)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L75_C4", "label": "b = list()", "type": "assigned_variable", "loc": [75, 75], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [14, 1, 0.7075, 0.0094, 1, 0.61, 0.625, 756, 3, 1, 0, 0, 430, 10, 2], "semantic": {"name": "b", "arg_names": [], "import_names": [], "rhs_call_name": "list", "annotation": ""}, "snippet": " b = list(c.items())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L76_C4", "label": "sort()", "type": "expression", "loc": [76, 76], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [8, 1, 0.717, 0.0094, 1, 0.61, 0.75, 489, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "sort", "arg_names": [], "import_names": [], "rhs_call_name": "sort", "annotation": ""}, "snippet": " b.sort(key=lambda item: item[1],reverse=True)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L77_C4", "label": "for item", "type": "for", "loc": [77, 78], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [6, 1, 0.7311, 0.0189, 1, 0.61, 0.875, 434, 6, 0, 0, 0, 0, 0, 2], "semantic": {"name": "item", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for item in b[:20]:\n print(item[0] +' - '+ str(item[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L78_C8", "label": "print()", "type": "expression", "loc": [78, 78], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L77_C4", "vector": [8, 2, 0.7358, 0.0094, 2, 0.57, 0.0, 535, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(item[0] +' - '+ str(item[1]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L79_C4", "label": "close()", "type": "expression", "loc": [79, 79], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "vector": [8, 1, 0.7453, 0.0094, 1, 0.61, 1.0, 77, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "close", "arg_names": [], "import_names": [], "rhs_call_name": "close", "annotation": ""}, "snippet": " fo.close()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "label": "main", "type": "function", "loc": [90, 103], "level": 0, "parent": null, "vector": [2, 0, 0.9104, 0.1321, 0, 0.66, 0.875, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2", "label": "if", "type": "if", "loc": [91, 93], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "vector": [4, 1, 0.8679, 0.0283, 1, 0.79, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L92_C4", "label": "print()", "type": "expression", "loc": [92, 92], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2", "vector": [8, 2, 0.8679, 0.0094, 2, 0.81, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L93_C4", "label": "exit()", "type": "expression", "loc": [93, 93], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2", "vector": [8, 2, 0.8774, 0.0094, 2, 0.81, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L95_C2", "label": "option =", "type": "assigned_variable", "loc": [95, 95], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "vector": [14, 1, 0.8962, 0.0094, 1, 0.79, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L96_C2", "label": "filename =", "type": "assigned_variable", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "vector": [14, 1, 0.9057, 0.0094, 1, 0.79, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2", "label": "if", "type": "if", "loc": [97, 103], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "vector": [4, 1, 0.9434, 0.066, 1, 0.79, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L98_C4", "label": "print_words()", "type": "expression", "loc": [98, 98], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2", "vector": [8, 2, 0.9245, 0.0094, 2, 0.69, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "label": "if", "type": "if", "loc": [99, 103], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2", "vector": [4, 2, 0.9528, 0.0472, 2, 0.69, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L100_C4", "label": "print_top()", "type": "expression", "loc": [100, 100], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "vector": [8, 3, 0.9434, 0.0094, 3, 0.39, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L102_C4", "label": "print()", "type": "expression", "loc": [102, 102], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "vector": [8, 3, 0.9623, 0.0094, 3, 0.39, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L103_C4", "label": "exit()", "type": "expression", "loc": [103, 103], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "vector": [8, 3, 0.9717, 0.0094, 3, 0.39, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L105_C0", "label": "if", "type": "if", "loc": [105, 106], "level": 0, "parent": null, "vector": [4, 0, 0.9953, 0.0189, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L106_C2", "label": "main()", "type": "expression", "loc": [106, 106], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L105_C0", "vector": [8, 1, 1.0, 0.0094, 1, 0.8, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L46_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L48_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L49_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L50_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L45_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L52_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L55_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L57_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L54_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L58_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L58_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L59_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L64_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L65_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L65_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L66_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L70_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L71_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L72_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L75_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L77_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:For_L77_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L78_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L69_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L79_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L92_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L91_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L95_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Assign_L96_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:FunctionDef_L90_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L98_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L97_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L100_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L102_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L99_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L103_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1225:If_L105_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1225:Expr_L106_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the file specified on the command line.
Do a simple split() on whitespace to obtain all the words in the file.
Rather than read the file line by line, it's easier to read
it into one giant string and split it once.
Build a "mimic" dict that maps each word that appears in the file
to a list of all the words that immediately follow that word in the file.
The list of words can be be in any order and should include
duplicates. So for example the key "and" might have the list
["then", "best", "then", "after", ...] listing
all the words which came after "and" in the text.
We'll say that the empty string is what comes before
the first word in the file.
With the mimic dict, it's fairly easy to emit random
text that mimics the original. Print a word, then look
up what words might come next and pick one at random as
the next work.
Use the empty string as the first word to prime things.
If we ever get stuck with a word that is not in the dict,
go back to the empty string to keep things moving.
Note: the standard python module 'random' includes a
random.choice(list) method which picks a random element
from a non-empty list.
For fun, feed your program to itself as input.
Could work on getting it to put in linebreaks around 70
columns, so the output looks better.
"""
import random
import sys
import re
def mimic_dict(filename):
"""Returns mimic dict mapping each word to list of words which follow it."""
f=open(filename,'r')
text=f.read()
text=re.sub("[/.,'`;:?!-()]","",text)
lines=text.lower().split()
if len(lines)==0:
return 0
mimic={"":lines[0]}
suf=[]
for i in range (len(lines)):
if mimic.get(lines[i])==None:
j=i
for j in range (len(lines)-1):
if lines[i]==lines[j]:
suf.append(lines[j+1])
mimic.update({lines[i]:suf})
suf=[]
return mimic
def print_mimic(mimic_dict, word):
"""Given mimic dict and start word, prints 200 random words."""
if mimic_dict==0:
print "Sorry, your file is empty :("
return
for i in range(200):
if word=='' or mimic_dict.get(word)==[]:
word=mimic_dict.get('')
sys.stdout.write("%s " %(word))
else:
word=random.choice(mimic_dict.get(word))
sys.stdout.write("%s " %(word))
return
# Provided main(), calls mimic_dict() and mimic()
def main():
if len(sys.argv) != 2:
print 'usage: ./mimic.py file-to-read'
sys.exit(1)
dict = mimic_dict(sys.argv[1])
print_mimic(dict, '')
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1228 | 43 | 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_1228:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 42], "level": 0, "parent": null, "vector": [8, 0, 0.2656, 0.3542, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Mimic pyquick exercise -- optional extra exercise.\nGoogle's Python Class\n\nRead in the file specified on the command line.\nDo a simple split() on whitespace to obtain all the words in the file.\nRather than read the file line by line, it's easier to read\nit into one giant string and split it once.\n"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Import_L44_C0", "label": "random import random", "type": "import", "loc": [44, 44], "level": 0, "parent": null, "vector": [1, 0, 0.4583, 0.0104, 0, 0.66, 0.1429, 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_1228:Import_L45_C0", "label": "sys import sys", "type": "import", "loc": [45, 45], "level": 0, "parent": null, "vector": [1, 0, 0.4688, 0.0104, 0, 0.66, 0.2857, 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_1228:Import_L46_C0", "label": "re import re", "type": "import", "loc": [46, 46], "level": 0, "parent": null, "vector": [1, 0, 0.4792, 0.0104, 0, 0.66, 0.4286, 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_1228:FunctionDef_L49_C0", "label": "mimic_dict", "type": "function", "loc": [49, 67], "level": 0, "parent": null, "vector": [2, 0, 0.6042, 0.1979, 0, 0.66, 0.5714, 49, 0, 1, 1, 0, 0, 0, 13], "semantic": {"name": "mimic_dict", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def mimic_dict(filename):\n \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\"\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[/.,'`;:?!-()]\",\"\",text)\n lines=text.lower().split()\n if len(lines)==0:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L50_C2", "label": "expression", "type": "expression", "loc": [50, 50], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [8, 1, 0.5208, 0.0104, 1, 0.11, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Returns mimic dict mapping each word to list of words which follow it.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L51_C2", "label": "f = open()", "type": "assigned_variable", "loc": [51, 51], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.5312, 0.0104, 1, 0.11, 0.1111, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L52_C2", "label": "text = read()", "type": "assigned_variable", "loc": [52, 52], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.5417, 0.0104, 1, 0.11, 0.2222, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text=f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L53_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.5521, 0.0104, 1, 0.11, 0.3333, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text=re.sub(\"[/.,'`;:?!-()]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L54_C2", "label": "lines = split()", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.5625, 0.0104, 1, 0.11, 0.4444, 73, 3, 0, 0, 0, 908, 10, 2], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "split", "annotation": ""}, "snippet": " lines=text.lower().split()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L55_C2", "label": "if", "type": "if", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [4, 1, 0.5781, 0.0208, 1, 0.11, 0.5556, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(lines)==0:\n return 0"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L56_C4", "label": "return", "type": "return", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L55_C2", "vector": [13, 2, 0.5833, 0.0104, 2, 0.61, 0.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_1228:Assign_L57_C2", "label": "mimic =", "type": "assigned_variable", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.5938, 0.0104, 1, 0.11, 0.6667, 615, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "mimic", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " mimic={\"\":lines[0]}"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L58_C2", "label": "suf =", "type": "assigned_variable", "loc": [58, 58], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [14, 1, 0.6042, 0.0104, 1, 0.11, 0.7778, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L59_C2", "label": "for i", "type": "for", "loc": [59, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [6, 1, 0.651, 0.0833, 1, 0.11, 0.8889, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range (len(lines)):\n if mimic.get(lines[i])==None:\n j=i\n for j in range (len(lines)-1):\n if lines[i]==lines[j]:\n suf.append(lines[j+1])\n mimic.update({lines[i]:suf})\n suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "label": "if", "type": "if", "loc": [60, 66], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L59_C2", "vector": [4, 2, 0.6562, 0.0729, 2, 0.01, 0.0, 0, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic.get(lines[i])==None:\n j=i\n for j in range (len(lines)-1):\n if lines[i]==lines[j]:\n suf.append(lines[j+1])\n mimic.update({lines[i]:suf})\n suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L61_C6", "label": "j =", "type": "assigned_variable", "loc": [61, 61], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "vector": [14, 3, 0.6354, 0.0104, 3, 0.26, 0.0, 100, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " j=i"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L62_C6", "label": "for j", "type": "for", "loc": [62, 64], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "vector": [6, 3, 0.6562, 0.0312, 3, 0.26, 0.3333, 100, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "j", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for j in range (len(lines)-1):\n if lines[i]==lines[j]:\n suf.append(lines[j+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L63_C8", "label": "if", "type": "if", "loc": [63, 64], "level": 4, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L62_C6", "vector": [4, 4, 0.6615, 0.0208, 4, 0.37, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lines[i]==lines[j]:\n suf.append(lines[j+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L64_C10", "label": "append()", "type": "expression", "loc": [64, 64], "level": 5, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L63_C8", "vector": [8, 5, 0.6667, 0.0104, 5, 0.54, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " suf.append(lines[j+1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L65_C6", "label": "update()", "type": "expression", "loc": [65, 65], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "vector": [8, 3, 0.6771, 0.0104, 3, 0.26, 0.6667, 637, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "update", "arg_names": [], "import_names": [], "rhs_call_name": "update", "annotation": ""}, "snippet": " mimic.update({lines[i]:suf})"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L66_C6", "label": "suf =", "type": "assigned_variable", "loc": [66, 66], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "vector": [14, 3, 0.6875, 0.0104, 3, 0.26, 1.0, 893, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "suf", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " suf=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L67_C2", "label": "return", "type": "return", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "vector": [13, 1, 0.6979, 0.0104, 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 mimic"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "label": "print_mimic", "type": "function", "loc": [70, 82], "level": 0, "parent": null, "vector": [2, 0, 0.7917, 0.1354, 0, 0.66, 0.7143, 927, 0, 2, 0, 0, 0, 0, 8], "semantic": {"name": "print_mimic", "arg_names": ["mimic_dict", "word"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_mimic(mimic_dict, word):\n \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\"\n if mimic_dict==0:\n print(\"Sorry, your file is empty :(\")\n return\n for i in range(200):\n if word=='' or mimic_dict.get(word)==[]:\n word=mimic_dict.get('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L71_C2", "label": "expression", "type": "expression", "loc": [71, 71], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "vector": [8, 1, 0.7396, 0.0104, 1, 0.7, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " \"\"\"Given mimic dict and start word, prints 200 random words.\"\"\""}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2", "label": "if", "type": "if", "loc": [72, 74], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "vector": [4, 1, 0.7604, 0.0312, 1, 0.7, 0.3333, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if mimic_dict==0:\n print(\"Sorry, your file is empty :(\")\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L73_C4", "label": "print()", "type": "expression", "loc": [73, 73], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2", "vector": [8, 2, 0.7604, 0.0104, 2, 0.93, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(\"Sorry, your file is empty :(\")"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L74_C4", "label": "return", "type": "return", "loc": [74, 74], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2", "vector": [13, 2, 0.7708, 0.0104, 2, 0.93, 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_1228:For_L75_C2", "label": "for i", "type": "for", "loc": [75, 81], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "vector": [6, 1, 0.8125, 0.0729, 1, 0.7, 0.6667, 826, 3, 0, 0, 0, 0, 0, 7], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(200):\n if word=='' or mimic_dict.get(word)==[]:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "label": "if", "type": "if", "loc": [76, 81], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L75_C2", "vector": [4, 2, 0.8177, 0.0625, 2, 0.69, 0.0, 0, 0, 0, 0, 0, 0, 0, 6], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if word=='' or mimic_dict.get(word)==[]:\n word=mimic_dict.get('')\n sys.stdout.write(\"%s \" %(word))\n else:\n word=random.choice(mimic_dict.get(word))\n sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L77_C6", "label": "word = get()", "type": "assigned_variable", "loc": [77, 77], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "vector": [14, 3, 0.8021, 0.0104, 3, 0.27, 0.0, 107, 3, 1, 0, 0, 607, 10, 1], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "get", "annotation": ""}, "snippet": " word=mimic_dict.get('')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L78_C6", "label": "write()", "type": "expression", "loc": [78, 78], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "vector": [8, 3, 0.8125, 0.0104, 3, 0.27, 0.3333, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L80_C6", "label": "word = choice()", "type": "assigned_variable", "loc": [80, 80], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "vector": [14, 3, 0.8333, 0.0104, 3, 0.27, 0.6667, 107, 3, 1, 0, 0, 30, 10, 2], "semantic": {"name": "word", "arg_names": [], "import_names": [], "rhs_call_name": "choice", "annotation": ""}, "snippet": " word=random.choice(mimic_dict.get(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L81_C6", "label": "write()", "type": "expression", "loc": [81, 81], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "vector": [8, 3, 0.8438, 0.0104, 3, 0.27, 1.0, 837, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "write", "arg_names": [], "import_names": [], "rhs_call_name": "write", "annotation": ""}, "snippet": " sys.stdout.write(\"%s \" %(word))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L82_C2", "label": "return", "type": "return", "loc": [82, 82], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "vector": [13, 1, 0.8542, 0.0104, 1, 0.7, 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_1228:FunctionDef_L86_C0", "label": "main", "type": "function", "loc": [86, 92], "level": 0, "parent": null, "vector": [2, 0, 0.9271, 0.0729, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 5], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)\n\n dict = mimic_dict(sys.argv[1])\n print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2", "label": "if", "type": "if", "loc": [87, 89], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "vector": [4, 1, 0.9167, 0.0312, 1, 0.02, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 2:\n print('usage: ./mimic.py file-to-read')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L88_C4", "label": "print()", "type": "expression", "loc": [88, 88], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2", "vector": [8, 2, 0.9167, 0.0104, 2, 0.32, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./mimic.py file-to-read')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L89_C4", "label": "exit()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2", "vector": [8, 2, 0.9271, 0.0104, 2, 0.32, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L91_C2", "label": "dict = mimic_dict()", "type": "assigned_variable", "loc": [91, 91], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "vector": [14, 1, 0.9479, 0.0104, 1, 0.02, 0.5, 827, 3, 1, 0, 0, 49, 10, 1], "semantic": {"name": "dict", "arg_names": [], "import_names": [], "rhs_call_name": "mimic_dict", "annotation": ""}, "snippet": " dict = mimic_dict(sys.argv[1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L92_C2", "label": "print_mimic()", "type": "expression", "loc": [92, 92], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "vector": [8, 1, 0.9583, 0.0104, 1, 0.02, 1.0, 927, 3, 2, 0, 0, 0, 0, 1], "semantic": {"name": "print_mimic", "arg_names": [], "import_names": [], "rhs_call_name": "print_mimic", "annotation": ""}, "snippet": " print_mimic(dict, '')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L95_C0", "label": "if", "type": "if", "loc": [95, 96], "level": 0, "parent": null, "vector": [4, 0, 0.9948, 0.0208, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L96_C2", "label": "main()", "type": "expression", "loc": [96, 96], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L95_C0", "vector": [8, 1, 1.0, 0.0104, 1, 0.6, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L51_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L52_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L59_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L59_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L61_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L62_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L62_C6", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L63_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L63_C8", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L64_C10"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L65_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L60_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L66_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L49_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L71_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L73_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L72_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L74_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L75_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:For_L75_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L77_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L78_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L80_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L76_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L81_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L70_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Return_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L88_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L87_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Assign_L91_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:FunctionDef_L86_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L92_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1228:If_L95_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1228:Expr_L96_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic list exercises
# D. Given a list of numbers, return a list where
# all adjacent == elements have been reduced to a single element,
# so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or
# modify the passed in list.
def remove_adjacent(nums):
i=1
newlist=[]
for i in range (len(nums)):
if nums[i]!=nums[i-1]:
newlist.append(nums[i])
return newlist
# E. Given two lists sorted in increasing order, create and return a merged
# list of all the elements in sorted order. You may modify the passed in lists.
# Ideally, the solution should work in "linear" time, making a single
# pass of both lists.
def linear_merge(list1, list2):
list1.extend(list2)
return sorted(list1)
# Note: the solution above is kind of cute, but unforunately list.pop(0)
# is not constant time with the standard python list implementation, so
# the above is not strictly linear time.
# An alternate approach uses pop(-1) to remove the endmost elements
# from each list, building a solution list which is backwards.
# Then use reversed() to put the result back in the correct order. That
# solution works in linear time, but is more ugly.
# Simple provided test() function used in main() to print
# what each function returns vs. what it's supposed to return.
def test(got, expected):
if got == expected:
prefix = ' OK '
else:
prefix = ' X '
print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected))
# Calls the above functions with interesting inputs.
def main():
print 'remove_adjacent'
test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])
test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])
test(remove_adjacent([]), [])
print
print 'linear_merge'
test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),
['aa', 'bb', 'cc', 'xx', 'zz'])
test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),
['aa', 'aa', 'aa', 'bb', 'bb'])
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1232 | 25 | 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_1232:FunctionDef_L15_C0", "label": "remove_adjacent", "type": "function", "loc": [15, 21], "level": 0, "parent": null, "vector": [2, 0, 0.2687, 0.1045, 0, 0.66, 0.0, 855, 0, 1, 1, 0, 0, 0, 3], "semantic": {"name": "remove_adjacent", "arg_names": ["nums"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def remove_adjacent(nums):\n i=1\n newlist=[]\n for i in range (len(nums)):\n if nums[i]!=nums[i-1]:\n newlist.append(nums[i])\n return newlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L16_C2", "label": "i =", "type": "assigned_variable", "loc": [16, 16], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "vector": [14, 1, 0.2388, 0.0149, 1, 0.62, 0.0, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L17_C2", "label": "newlist =", "type": "assigned_variable", "loc": [17, 17], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "vector": [14, 1, 0.2537, 0.0149, 1, 0.62, 0.3333, 646, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "newlist", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newlist=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:For_L18_C2", "label": "for i", "type": "for", "loc": [18, 20], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "vector": [6, 1, 0.2836, 0.0448, 1, 0.62, 0.6667, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range (len(nums)):\n if nums[i]!=nums[i-1]:\n newlist.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L19_C4", "label": "if", "type": "if", "loc": [19, 20], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:For_L18_C2", "vector": [4, 2, 0.291, 0.0299, 2, 0.73, 0.0, 0, 0, 0, 0, 0, 0, 0, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if nums[i]!=nums[i-1]:\n newlist.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L20_C6", "label": "append()", "type": "expression", "loc": [20, 20], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L19_C4", "vector": [8, 3, 0.2985, 0.0149, 3, 0.02, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newlist.append(nums[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Return_L21_C2", "label": "return", "type": "return", "loc": [21, 21], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "vector": [13, 1, 0.3134, 0.0149, 1, 0.62, 1.0, 0, 2, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return newlist"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L28_C0", "label": "linear_merge", "type": "function", "loc": [28, 30], "level": 0, "parent": null, "vector": [2, 0, 0.4328, 0.0448, 0, 0.66, 0.25, 96, 0, 2, 1, 0, 0, 0, 2], "semantic": {"name": "linear_merge", "arg_names": ["list1", "list2"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def linear_merge(list1, list2):\n list1.extend(list2)\n return sorted(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L29_C2", "label": "extend()", "type": "expression", "loc": [29, 29], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L28_C0", "vector": [8, 1, 0.4328, 0.0149, 1, 0.72, 0.0, 660, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "extend", "arg_names": [], "import_names": [], "rhs_call_name": "extend", "annotation": ""}, "snippet": " list1.extend(list2)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Return_L30_C2", "label": "return", "type": "return", "loc": [30, 30], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L28_C0", "vector": [13, 1, 0.4478, 0.0149, 1, 0.72, 1.0, 0, 3, 0, 0, 0, 0, 10, 1], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " return sorted(list1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L43_C0", "label": "test", "type": "function", "loc": [43, 48], "level": 0, "parent": null, "vector": [2, 0, 0.6791, 0.0896, 0, 0.66, 0.5, 224, 0, 2, 0, 0, 0, 0, 3], "semantic": {"name": "test", "arg_names": ["got", "expected"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2", "label": "if", "type": "if", "loc": [44, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L43_C0", "vector": [4, 1, 0.6791, 0.0597, 1, 0.65, 0.0, 0, 0, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L45_C4", "label": "prefix =", "type": "assigned_variable", "loc": [45, 45], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2", "vector": [14, 2, 0.6716, 0.0149, 2, 0.11, 0.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' OK '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L47_C4", "label": "prefix =", "type": "assigned_variable", "loc": [47, 47], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2", "vector": [14, 2, 0.7015, 0.0149, 2, 0.11, 1.0, 284, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "prefix", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " prefix = ' X '"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L48_C2", "label": "print()", "type": "expression", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L43_C0", "vector": [8, 1, 0.7164, 0.0149, 1, 0.65, 1.0, 535, 3, 1, 0, 0, 0, 0, 3], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('%s got: %s expected: %s' % (prefix, repr(got), repr(expected)))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "label": "main", "type": "function", "loc": [52, 63], "level": 0, "parent": null, "vector": [2, 0, 0.8582, 0.1791, 0, 0.66, 0.75, 624, 0, 0, 0, 0, 0, 0, 13], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n print('remove_adjacent')\n test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])\n test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])\n test(remove_adjacent([]), [])\n\n test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L53_C2", "label": "print()", "type": "expression", "loc": [53, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.791, 0.0149, 1, 0.85, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('remove_adjacent')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L54_C2", "label": "test()", "type": "expression", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.806, 0.0149, 1, 0.85, 0.1667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([1, 2, 2, 3]), [1, 2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L55_C2", "label": "test()", "type": "expression", "loc": [55, 55], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.8209, 0.0149, 1, 0.85, 0.3333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([2, 2, 3, 3, 3]), [2, 3])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L56_C2", "label": "test()", "type": "expression", "loc": [56, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.8358, 0.0149, 1, 0.85, 0.5, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(remove_adjacent([]), [])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L58_C2", "label": "test()", "type": "expression", "loc": [58, 59], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.8731, 0.0299, 1, 0.85, 0.6667, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx', 'zz'], ['bb', 'cc']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L60_C2", "label": "test()", "type": "expression", "loc": [60, 61], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.903, 0.0299, 1, 0.85, 0.8333, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'xx'], ['bb', 'cc', 'zz']),\n ['aa', 'bb', 'cc', 'xx', 'zz'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L62_C2", "label": "test()", "type": "expression", "loc": [62, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "vector": [8, 1, 0.9328, 0.0299, 1, 0.85, 1.0, 224, 3, 2, 0, 0, 0, 0, 2], "semantic": {"name": "test", "arg_names": [], "import_names": [], "rhs_call_name": "test", "annotation": ""}, "snippet": " test(linear_merge(['aa', 'aa'], ['aa', 'bb', 'bb']),\n ['aa', 'aa', 'aa', 'bb', 'bb'])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L66_C0", "label": "if", "type": "if", "loc": [66, 67], "level": 0, "parent": null, "vector": [4, 0, 0.9925, 0.0299, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L67_C2", "label": "main()", "type": "expression", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L66_C0", "vector": [8, 1, 1.0, 0.0149, 1, 0.44, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L16_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L17_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:For_L18_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:For_L18_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L20_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Return_L21_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L29_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L28_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Return_L30_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L45_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L44_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Assign_L47_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L53_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L56_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L58_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:FunctionDef_L52_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L62_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1232:If_L66_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1232:Expr_L67_C2"}] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
import re
def readfile(filename):
f=open(filename,'r')
text=f.read()
text=re.sub("[/.,\';:?!-]","",text)
lines=sorted(text.lower().split())
newlines=[]
i=1
for i in range(len(lines)):
if lines[i]!=lines[i-1]:
newlines.append(lines[i])
newlines.append(lines.count(lines[i]))
arr=[]
for i in range(len(newlines)/2):
arr.append(tuple(newlines[i*2:i*2+2]))
return arr
def print_words(filename):
arr=readfile(filename)
for i in range (len(arr)):
print arr[i][0],'\t',arr[i][1]
return
def print_top(filename):
arr=readfile(filename)
newarr=sorted(arr, key=lambda arr:arr[-1:])
for i in range (len(newarr)):
print newarr[i][0],'\t',newarr[i][1]
return
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| ajibawa-2023/Python-Code-Large/train/row_1233 | 43 | 97 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L9_C0", "label": "expression", "type": "expression", "loc": [9, 38], "level": 0, "parent": null, "vector": [8, 0, 0.2423, 0.3093, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "\"\"\"Wordcount exercise\nGoogle's Python class\n\nThe main() below is already defined and complete. It calls print_words()\nand print_top() functions which you write.\n\n1. For the --count flag, implement a print_words(filename) function that counts\nhow often each word appears in the text and prints:"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Import_L40_C0", "label": "sys import sys", "type": "import", "loc": [40, 40], "level": 0, "parent": null, "vector": [1, 0, 0.4124, 0.0103, 0, 0.66, 0.1429, 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_1233:Import_L41_C0", "label": "re import re", "type": "import", "loc": [41, 41], "level": 0, "parent": null, "vector": [1, 0, 0.4227, 0.0103, 0, 0.66, 0.2857, 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_1233:FunctionDef_L43_C0", "label": "readfile", "type": "function", "loc": [43, 57], "level": 0, "parent": null, "vector": [2, 0, 0.5155, 0.1546, 0, 0.66, 0.4286, 335, 0, 1, 1, 0, 0, 0, 15], "semantic": {"name": "readfile", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def readfile(filename):\n f=open(filename,'r')\n text=f.read()\n text=re.sub(\"[/.,\\';:?!-]\",\"\",text)\n lines=sorted(text.lower().split())\n newlines=[]\n i=1\n for i in range(len(lines)):"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L44_C2", "label": "f = open()", "type": "assigned_variable", "loc": [44, 44], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.4536, 0.0103, 1, 0.73, 0.0, 899, 3, 2, 0, 0, 693, 10, 1], "semantic": {"name": "f", "arg_names": [], "import_names": [], "rhs_call_name": "open", "annotation": ""}, "snippet": " f=open(filename,'r')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L45_C2", "label": "text = read()", "type": "assigned_variable", "loc": [45, 45], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.4639, 0.0103, 1, 0.73, 0.1111, 439, 3, 0, 0, 0, 453, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "read", "annotation": ""}, "snippet": " text=f.read()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L46_C2", "label": "text = sub()", "type": "assigned_variable", "loc": [46, 46], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.4742, 0.0103, 1, 0.73, 0.2222, 439, 3, 3, 0, 0, 819, 10, 1], "semantic": {"name": "text", "arg_names": [], "import_names": [], "rhs_call_name": "sub", "annotation": ""}, "snippet": " text=re.sub(\"[/.,\\';:?!-]\",\"\",text)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L47_C2", "label": "lines = sorted()", "type": "assigned_variable", "loc": [47, 47], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.4845, 0.0103, 1, 0.73, 0.3333, 73, 3, 1, 0, 0, 134, 10, 3], "semantic": {"name": "lines", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " lines=sorted(text.lower().split())"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L48_C2", "label": "newlines =", "type": "assigned_variable", "loc": [48, 48], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.4948, 0.0103, 1, 0.73, 0.4444, 73, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "newlines", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " newlines=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L49_C2", "label": "i =", "type": "assigned_variable", "loc": [49, 49], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.5052, 0.0103, 1, 0.73, 0.5556, 826, 1, 0, 0, 0, 0, 1, 0], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " i=1"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L50_C2", "label": "for i", "type": "for", "loc": [50, 53], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [6, 1, 0.5309, 0.0412, 1, 0.73, 0.6667, 826, 3, 0, 0, 0, 0, 0, 5], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(lines)):\n if lines[i]!=lines[i-1]:\n newlines.append(lines[i])\n newlines.append(lines.count(lines[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4", "label": "if", "type": "if", "loc": [51, 53], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L50_C2", "vector": [4, 2, 0.5361, 0.0309, 2, 0.26, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if lines[i]!=lines[i-1]:\n newlines.append(lines[i])\n newlines.append(lines.count(lines[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L52_C6", "label": "append()", "type": "expression", "loc": [52, 52], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4", "vector": [8, 3, 0.5361, 0.0103, 3, 0.42, 0.0, 243, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newlines.append(lines[i])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L53_C6", "label": "append()", "type": "expression", "loc": [53, 53], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4", "vector": [8, 3, 0.5464, 0.0103, 3, 0.42, 1.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " newlines.append(lines.count(lines[i]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L54_C2", "label": "arr =", "type": "assigned_variable", "loc": [54, 54], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [14, 1, 0.5567, 0.0103, 1, 0.73, 0.7778, 395, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " arr=[]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L55_C2", "label": "for i", "type": "for", "loc": [55, 56], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [6, 1, 0.5722, 0.0206, 1, 0.73, 0.8889, 826, 3, 0, 0, 0, 0, 0, 4], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range(len(newlines)/2):\n arr.append(tuple(newlines[i*2:i*2+2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L56_C4", "label": "append()", "type": "expression", "loc": [56, 56], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L55_C2", "vector": [8, 2, 0.5773, 0.0103, 2, 0.46, 0.0, 243, 3, 1, 0, 0, 0, 0, 2], "semantic": {"name": "append", "arg_names": [], "import_names": [], "rhs_call_name": "append", "annotation": ""}, "snippet": " arr.append(tuple(newlines[i*2:i*2+2]))"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L57_C2", "label": "return", "type": "return", "loc": [57, 57], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "vector": [13, 1, 0.5876, 0.0103, 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 arr"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "label": "print_words", "type": "function", "loc": [59, 63], "level": 0, "parent": null, "vector": [2, 0, 0.6289, 0.0515, 0, 0.66, 0.5714, 267, 0, 1, 0, 0, 0, 0, 4], "semantic": {"name": "print_words", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_words(filename):\n arr=readfile(filename)\n for i in range (len(arr)):\n print(arr[i][0],'\\t',arr[i][1])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L60_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [60, 60], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "vector": [14, 1, 0.6186, 0.0103, 1, 0.04, 0.0, 395, 3, 1, 0, 0, 335, 10, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "readfile", "annotation": ""}, "snippet": " arr=readfile(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L61_C2", "label": "for i", "type": "for", "loc": [61, 62], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "vector": [6, 1, 0.634, 0.0206, 1, 0.04, 0.5, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range (len(arr)):\n print(arr[i][0],'\\t',arr[i][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L62_C4", "label": "print()", "type": "expression", "loc": [62, 62], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L61_C2", "vector": [8, 2, 0.6392, 0.0103, 2, 0.38, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(arr[i][0],'\\t',arr[i][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L63_C2", "label": "return", "type": "return", "loc": [63, 63], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "vector": [13, 1, 0.6495, 0.0103, 1, 0.04, 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_1233:FunctionDef_L65_C0", "label": "print_top", "type": "function", "loc": [65, 70], "level": 0, "parent": null, "vector": [2, 0, 0.6959, 0.0619, 0, 0.66, 0.7143, 148, 0, 1, 0, 0, 0, 0, 5], "semantic": {"name": "print_top", "arg_names": ["filename"], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def print_top(filename):\n arr=readfile(filename)\n newarr=sorted(arr, key=lambda arr:arr[-1:])\n for i in range (len(newarr)):\n print(newarr[i][0],'\\t',newarr[i][1])\n return"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L66_C2", "label": "arr = readfile()", "type": "assigned_variable", "loc": [66, 66], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "vector": [14, 1, 0.6804, 0.0103, 1, 0.97, 0.0, 395, 3, 1, 0, 0, 335, 10, 1], "semantic": {"name": "arr", "arg_names": [], "import_names": [], "rhs_call_name": "readfile", "annotation": ""}, "snippet": " arr=readfile(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L67_C2", "label": "newarr = sorted()", "type": "assigned_variable", "loc": [67, 67], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "vector": [14, 1, 0.6907, 0.0103, 1, 0.97, 0.3333, 55, 3, 2, 0, 0, 134, 10, 1], "semantic": {"name": "newarr", "arg_names": [], "import_names": [], "rhs_call_name": "sorted", "annotation": ""}, "snippet": " newarr=sorted(arr, key=lambda arr:arr[-1:])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L68_C2", "label": "for i", "type": "for", "loc": [68, 69], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "vector": [6, 1, 0.7062, 0.0206, 1, 0.97, 0.6667, 826, 3, 0, 0, 0, 0, 0, 3], "semantic": {"name": "i", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " for i in range (len(newarr)):\n print(newarr[i][0],'\\t',newarr[i][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L69_C4", "label": "print()", "type": "expression", "loc": [69, 69], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L68_C2", "vector": [8, 2, 0.7113, 0.0103, 2, 0.76, 0.0, 535, 3, 3, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print(newarr[i][0],'\\t',newarr[i][1])"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L70_C2", "label": "return", "type": "return", "loc": [70, 70], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "vector": [13, 1, 0.7216, 0.0103, 1, 0.97, 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_1233:FunctionDef_L81_C0", "label": "main", "type": "function", "loc": [81, 94], "level": 0, "parent": null, "vector": [2, 0, 0.9021, 0.1443, 0, 0.66, 0.8571, 624, 0, 0, 0, 0, 0, 0, 7], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": "def main():\n if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)\n\n option = sys.argv[1]\n filename = sys.argv[2]\n if option == '--count':"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2", "label": "if", "type": "if", "loc": [82, 84], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "vector": [4, 1, 0.8557, 0.0309, 1, 0.47, 0.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if len(sys.argv) != 3:\n print('usage: ./wordcount.py {--count | --topcount} file')\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L83_C4", "label": "print()", "type": "expression", "loc": [83, 83], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2", "vector": [8, 2, 0.8557, 0.0103, 2, 0.31, 0.0, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('usage: ./wordcount.py {--count | --topcount} file')"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L84_C4", "label": "exit()", "type": "expression", "loc": [84, 84], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2", "vector": [8, 2, 0.866, 0.0103, 2, 0.31, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L86_C2", "label": "option =", "type": "assigned_variable", "loc": [86, 86], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "vector": [14, 1, 0.8866, 0.0103, 1, 0.47, 0.3333, 751, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "option", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " option = sys.argv[1]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L87_C2", "label": "filename =", "type": "assigned_variable", "loc": [87, 87], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "vector": [14, 1, 0.8969, 0.0103, 1, 0.47, 0.6667, 275, 6, 0, 0, 0, 0, 0, 0], "semantic": {"name": "filename", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " filename = sys.argv[2]"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2", "label": "if", "type": "if", "loc": [88, 94], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "vector": [4, 1, 0.9381, 0.0722, 1, 0.47, 1.0, 0, 0, 0, 0, 0, 0, 0, 4], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " if option == '--count':\n print_words(filename)\n elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L89_C4", "label": "print_words()", "type": "expression", "loc": [89, 89], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2", "vector": [8, 2, 0.9175, 0.0103, 2, 0.48, 0.0, 267, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_words", "arg_names": [], "import_names": [], "rhs_call_name": "print_words", "annotation": ""}, "snippet": " print_words(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "label": "if", "type": "if", "loc": [90, 94], "level": 2, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2", "vector": [4, 2, 0.9485, 0.0515, 2, 0.48, 1.0, 0, 0, 0, 0, 0, 0, 0, 3], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation": ""}, "snippet": " elif option == '--topcount':\n print_top(filename)\n else:\n print('unknown option: ' + option)\n sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L91_C4", "label": "print_top()", "type": "expression", "loc": [91, 91], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "vector": [8, 3, 0.9381, 0.0103, 3, 0.48, 0.0, 148, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print_top", "arg_names": [], "import_names": [], "rhs_call_name": "print_top", "annotation": ""}, "snippet": " print_top(filename)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L93_C4", "label": "print()", "type": "expression", "loc": [93, 93], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "vector": [8, 3, 0.9588, 0.0103, 3, 0.48, 0.5, 535, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "print", "arg_names": [], "import_names": [], "rhs_call_name": "print", "annotation": ""}, "snippet": " print('unknown option: ' + option)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L94_C4", "label": "exit()", "type": "expression", "loc": [94, 94], "level": 3, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "vector": [8, 3, 0.9691, 0.0103, 3, 0.48, 1.0, 436, 3, 1, 0, 0, 0, 0, 1], "semantic": {"name": "exit", "arg_names": [], "import_names": [], "rhs_call_name": "exit", "annotation": ""}, "snippet": " sys.exit(1)"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L96_C0", "label": "if", "type": "if", "loc": [96, 97], "level": 0, "parent": null, "vector": [4, 0, 0.9948, 0.0206, 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 main()"}, {"id": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L97_C2", "label": "main()", "type": "expression", "loc": [97, 97], "level": 1, "parent": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L96_C0", "vector": [8, 1, 1.0, 0.0103, 1, 0.57, 0.0, 624, 3, 0, 0, 0, 0, 0, 1], "semantic": {"name": "main", "arg_names": [], "import_names": [], "rhs_call_name": "main", "annotation": ""}, "snippet": " main()"}] | [{"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L44_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L46_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L47_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L48_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L49_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L50_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L50_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L52_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L51_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L53_C6"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L54_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L55_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L55_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L56_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L43_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L57_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L61_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L61_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L62_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L63_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L66_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L67_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L68_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:For_L68_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L69_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L65_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Return_L70_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L83_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L82_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L84_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L86_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Assign_L87_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:FunctionDef_L81_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L89_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L88_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L91_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L93_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L90_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L94_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_1233:If_L96_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_1233:Expr_L97_C2"}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.